From f1e409ea7e1e6a33be56fa176ca156c498741888 Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Tue, 13 Oct 2015 19:30:07 -0400 Subject: [PATCH] spec: drop ::foo fake module Stop using ::foo as a fake module and use a real module that is installed in Puppet OpenStack Puppetfile. Change-Id: I4027edd7a012158b830878b92783eaef4bf9bfdc --- .fixtures.yml | 4 +++ ...openstack_extras_pacemaker_service_spec.rb | 28 ++++++++++++------- .../modules/foo/files/scripts/foo.ocf | 0 spec/fixtures/modules/foo/manifests/init.pp | 3 -- .../modules/foo/templates/foo.ocf.erb | 1 - 5 files changed, 22 insertions(+), 14 deletions(-) delete mode 100644 spec/fixtures/modules/foo/files/scripts/foo.ocf delete mode 100644 spec/fixtures/modules/foo/manifests/init.pp delete mode 100644 spec/fixtures/modules/foo/templates/foo.ocf.erb diff --git a/.fixtures.yml b/.fixtures.yml index 09f5510..8d34dc4 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -3,5 +3,9 @@ fixtures: 'corosync': 'https://github.com/puppetlabs/puppetlabs-corosync' 'apt': 'git://github.com/puppetlabs/puppetlabs-apt' 'stdlib' : 'git://github.com/puppetlabs/puppetlabs-stdlib' + 'glance' : 'git://github.com/openstack/puppet-glance' + 'keystone' : 'git://github.com/openstack/puppet-keystone' + 'inifile': 'git://github.com/puppetlabs/puppetlabs-inifile' + 'openstacklib': 'git://github.com/stackforge/puppet-openstacklib.git' symlinks: 'openstack_extras': "#{source_dir}" diff --git a/spec/defines/openstack_extras_pacemaker_service_spec.rb b/spec/defines/openstack_extras_pacemaker_service_spec.rb index 02575f9..4dfc325 100644 --- a/spec/defines/openstack_extras_pacemaker_service_spec.rb +++ b/spec/defines/openstack_extras_pacemaker_service_spec.rb @@ -3,10 +3,18 @@ require 'spec_helper' describe 'openstack_extras::pacemaker::service', :type => :define do let :pre_condition do - "class { 'foo': }" + "class { '::glance::registry': + keystone_password => 'secrete', + }" end - let (:title) { 'foo-api' } + let :facts do + { :osfamily => 'Debian', + :operatingsystem => 'Debian' + } + end + + let (:title) { 'glance-registry' } let :default_params do { @@ -34,14 +42,14 @@ describe 'openstack_extras::pacemaker::service', :type => :define do end it 'should override existing service provider' do - is_expected.to contain_service('foo-api').with( + is_expected.to contain_service('glance-registry').with( { :provider => 'pacemaker' }) end it 'should create a pacemaker primitive' do - is_expected.to contain_cs_primitive('p_foo-api').with( + is_expected.to contain_cs_primitive('p_glance-registry').with( { 'ensure' => default_params[:ensure], 'primitive_class' => default_params[:primitive_class], @@ -54,7 +62,7 @@ describe 'openstack_extras::pacemaker::service', :type => :define do }) end it 'should not create a cloned resource' do - is_expected.to contain_cs_clone('p_foo-api-clone').with( + is_expected.to contain_cs_clone('p_glance-registry-clone').with( { 'ensure' => 'absent', }) @@ -103,7 +111,7 @@ describe 'openstack_extras::pacemaker::service', :type => :define do let(:params) do default_params.merge( { - :ocf_script_template => 'foo/foo.ocf.erb', + :ocf_script_template => 'openstack_extras/ocf_handler.erb', :use_handler => false, :primitive_provider => 'some_provider', :ocf_root_path => '/usr/lib/some_path', @@ -121,7 +129,7 @@ describe 'openstack_extras::pacemaker::service', :type => :define do 'mode' => '0755', 'owner' => 'root', 'group' => 'root' - }).with_content(/erb/) + }).with_content(/monitor/) end it 'should not create a handler file' do @@ -129,7 +137,7 @@ describe 'openstack_extras::pacemaker::service', :type => :define do end it 'should create a pacemaker primitive' do - is_expected.to contain_cs_primitive('p_foo-api').with( + is_expected.to contain_cs_primitive('p_glance-registry').with( { 'ensure' => params[:ensure], 'primitive_class' => params[:primitive_class], @@ -151,10 +159,10 @@ describe 'openstack_extras::pacemaker::service', :type => :define do }) end it 'should create a cloned resource' do - is_expected.to contain_cs_clone('p_foo-api-clone').with( + is_expected.to contain_cs_clone('p_glance-registry-clone').with( { 'ensure' => 'present', - 'primitive' => 'p_foo-api', + 'primitive' => 'p_glance-registry', }) end end diff --git a/spec/fixtures/modules/foo/files/scripts/foo.ocf b/spec/fixtures/modules/foo/files/scripts/foo.ocf deleted file mode 100644 index e69de29..0000000 diff --git a/spec/fixtures/modules/foo/manifests/init.pp b/spec/fixtures/modules/foo/manifests/init.pp deleted file mode 100644 index 1e367d1..0000000 --- a/spec/fixtures/modules/foo/manifests/init.pp +++ /dev/null @@ -1,3 +0,0 @@ -class foo () { - service { 'foo-api': } -} diff --git a/spec/fixtures/modules/foo/templates/foo.ocf.erb b/spec/fixtures/modules/foo/templates/foo.ocf.erb deleted file mode 100644 index c150680..0000000 --- a/spec/fixtures/modules/foo/templates/foo.ocf.erb +++ /dev/null @@ -1 +0,0 @@ -erb