X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=3rdparty%2Fmodules%2Fopenstacklib%2Fspec%2Fdefines%2Fopenstacklib_db_mysql_host_access_spec.rb;fp=3rdparty%2Fmodules%2Fopenstacklib%2Fspec%2Fdefines%2Fopenstacklib_db_mysql_host_access_spec.rb;h=8f47bfa136ea50370ba111153e6871dd837004de;hb=4631045ebb77ee8622f6fa09277a50c372bcc02e;hp=0000000000000000000000000000000000000000;hpb=3d4dc4fd9e59bd0e07646c99f6b356c7d9d859aa;p=mirror%2Fdsa-puppet.git diff --git a/3rdparty/modules/openstacklib/spec/defines/openstacklib_db_mysql_host_access_spec.rb b/3rdparty/modules/openstacklib/spec/defines/openstacklib_db_mysql_host_access_spec.rb new file mode 100644 index 000000000..8f47bfa13 --- /dev/null +++ b/3rdparty/modules/openstacklib/spec/defines/openstacklib_db_mysql_host_access_spec.rb @@ -0,0 +1,50 @@ +require 'spec_helper' + +describe 'openstacklib::db::mysql::host_access' do + + let :pre_condition do + "include mysql::server\n" + + "openstacklib::db::mysql { 'nova':\n" + + " password_hash => 'AA1420F182E88B9E5F874F6FBE7459291E8F4601'}" + end + + shared_examples 'openstacklib::db::mysql::host_access examples' do + + context 'with required parameters' do + let (:title) { 'nova_10.0.0.1' } + let :params do + { :user => 'foobar', + :password_hash => 'AA1420F182E88B9E5F874F6FBE7459291E8F4601', + :database => 'nova', + :privileges => 'ALL' } + end + + it { should contain_mysql_user("#{params[:user]}@10.0.0.1").with( + :password_hash => params[:password_hash] + )} + + it { should contain_mysql_grant("#{params[:user]}@10.0.0.1/#{params[:database]}.*").with( + :user => "#{params[:user]}@10.0.0.1", + :privileges => 'ALL', + :table => "#{params[:database]}.*" + )} + end + + end + + context 'on a Debian osfamily' do + let :facts do + { :osfamily => "Debian" } + end + + include_examples 'openstacklib::db::mysql::host_access examples' + end + + context 'on a RedHat osfamily' do + let :facts do + { :osfamily => 'RedHat' } + end + + include_examples 'openstacklib::db::mysql::host_access examples' + end +end