diff --git a/Gemfile b/Gemfile index eeb359d6..959ff607 100644 --- a/Gemfile +++ b/Gemfile @@ -1,11 +1,11 @@ source 'https://rubygems.org' -gem 'chef', '~> 11.8' +gem 'chef', '~> 11.12.0' gem 'json', '<= 1.7.7' # chef 11 dependency gem 'berkshelf', '~> 2.0.18' gem 'hashie', '~> 2.0' -gem 'chefspec', '~> 3.4.0' -gem 'rspec', '~> 2.14.1' +gem 'chefspec', '~> 4.0.0' +gem 'rspec', '~> 3.0.0' gem 'foodcritic', '~> 3.0.3' gem 'strainer' gem 'rubocop', '~> 0.18.1' diff --git a/spec/database_spec.rb b/spec/database_spec.rb index 877a7c86..593d2d6f 100644 --- a/spec/database_spec.rb +++ b/spec/database_spec.rb @@ -33,15 +33,15 @@ describe 'openstack-common::default' do end it 'creates database' do - pending 'TODO: test this LWRP' + skip 'TODO: test this LWRP' end it 'creates database user' do - pending 'TODO: test this LWRP' + skip 'TODO: test this LWRP' end it 'grants privs to database user' do - pending 'TODO: test this LWRP' + skip 'TODO: test this LWRP' end end end diff --git a/spec/endpoints_spec.rb b/spec/endpoints_spec.rb index d0a0a948..3b7536e4 100644 --- a/spec/endpoints_spec.rb +++ b/spec/endpoints_spec.rb @@ -73,7 +73,7 @@ describe 'openstack-common::set_endpoints_by_interface' do end it 'returns endpoint URI object when uri key not in endpoint hash but host is in hash' do - pending 'TODO: implement' + skip 'TODO: implement' subject.should_receive(:uri_from_hash).with('host' => 'localhost', 'port' => '8080') uri_hash = { 'openstack' => { @@ -159,7 +159,7 @@ describe 'openstack-common::set_endpoints_by_interface' do it 'returns db info hash when service found' do subject.stub(:node).and_return(chef_run.node) expect(subject.db('compute')['host']).to eq('127.0.0.1') - expect(subject.db('compute').key?('uri')).to be_false + expect(subject.db('compute').key?('uri')).to be_falsey end end diff --git a/spec/logging_spec.rb b/spec/logging_spec.rb index 61bb4f06..3705e0e7 100644 --- a/spec/logging_spec.rb +++ b/spec/logging_spec.rb @@ -27,6 +27,10 @@ describe 'openstack-common::logging' do describe 'logging.conf' do let(:file) { chef_run.template('/etc/openstack/logging.conf') } + it 'should create /etc/openstack/logging.conf' do + expect(chef_run).to create_template(file.name) + end + it 'has proper owner' do expect(file.owner).to eq('root') expect(file.group).to eq('root') diff --git a/spec/sysctl_spec.rb b/spec/sysctl_spec.rb index 5eded653..e8a59196 100644 --- a/spec/sysctl_spec.rb +++ b/spec/sysctl_spec.rb @@ -7,9 +7,21 @@ describe 'openstack-common::sysctl' do let(:node) { runner.node } let(:chef_run) { runner.converge(described_recipe) } + describe 'sysctl.d directory' do + + it 'should create /etc/systctl.d' do + expect(chef_run).to create_directory('/etc/sysctl.d') + end + + end + describe '60-openstack.conf' do let(:file) { chef_run.template('/etc/sysctl.d/60-openstack.conf') } + it 'should create the template /etc/systctl.d/60-openstack.conf' do + expect(chef_run).to create_template('/etc/sysctl.d/60-openstack.conf') + end + it 'has proper owner' do expect(file.owner).to eq('root') expect(file.group).to eq('root') @@ -27,6 +39,17 @@ describe 'openstack-common::sysctl' do expect(chef_run).to render_file(file.name).with_content(/^#{k} = #{v}$/) end end + + end + + describe 'execute sysctl' do + + it 'should execute sysctl for 60-openstack' do + resource = chef_run.execute('sysctl -p /etc/sysctl.d/60-openstack.conf') + expect(resource).to do_nothing + expect(resource).to subscribe_to('template[/etc/sysctl.d/60-openstack.conf]').on(:run).immediately + end + end end end