Browse Source

spec: updates for rspec-puppet 2.x and rspec 3.x

This patch aim to update our specs test in order to work with the
rspec-puppet release 2.0.0, in the mean time, we update rspec syntax
in order to be prepared for rspec 3.x move.

In details:
  * Use shared_examples "a Puppet::Error" for puppet::error tests
  * Convert 'should' keyword to 'is_expected.to' (prepare rspec 3.x)
  * Fix spec tests for rspec-puppet 2.0.0
  * Upgrade and pin rspec-puppet from 1.0.1 to 2.0.0
  * Clean Gemfile (remove over-specificication of runtime deps of puppetlabs_spec_helper)
  * Remove un-used puppet-lint (name_containing_dash config)

Change-Id: I1b82e4f6ec0b1bbf52e86c5d127413a26277ae8c
Card: https://trello.com/c/eHXc1Ryd/4-investigate-the-necessary-change-to-be-rspec-puppet-2-0-0-compliant
tags/6.0.0
Sebastien Badia 4 years ago
parent
commit
d7e9fe0e7a

+ 5
- 5
Gemfile View File

@@ -2,11 +2,11 @@ source 'https://rubygems.org'
2 2
 
3 3
 group :development, :test do
4 4
   gem 'puppetlabs_spec_helper', :require => false
5
-  gem 'puppet-lint', '~> 1.1'
6
-  gem 'rspec-puppet', '~> 1.0.1'
7
-  gem 'puppet-lint-param-docs', '1.1.0'
8
-  gem 'rake', '10.1.1'
9
-  gem 'rspec', '< 2.99'
5
+  gem 'rspec-puppet', '~> 2.0.0', :require => false
6
+
7
+  gem 'metadata-json-lint'
8
+  gem 'puppet-lint-param-docs'
9
+
10 10
   gem 'json'
11 11
   gem 'webmock'
12 12
 end

+ 0
- 1
Rakefile View File

@@ -2,6 +2,5 @@ require 'puppetlabs_spec_helper/rake_tasks'
2 2
 require 'puppet-lint/tasks/puppet-lint'
3 3
 
4 4
 PuppetLint.configuration.fail_on_warnings = true
5
-PuppetLint.configuration.send('disable_names_containing_dash')
6 5
 PuppetLint.configuration.send('disable_80chars')
7 6
 PuppetLint.configuration.send('disable_class_parameter_defaults')

+ 16
- 16
spec/classes/heat_api_cfn_spec.rb View File

@@ -14,13 +14,13 @@ describe 'heat::api_cfn' do
14 14
 
15 15
     context 'config params' do
16 16
 
17
-      it { should contain_class('heat') }
18
-      it { should contain_class('heat::params') }
19
-      it { should contain_class('heat::policy') }
17
+      it { is_expected.to contain_class('heat') }
18
+      it { is_expected.to contain_class('heat::params') }
19
+      it { is_expected.to contain_class('heat::policy') }
20 20
 
21
-      it { should contain_heat_config('heat_api_cfn/bind_host').with_value( params[:bind_host] ) }
22
-      it { should contain_heat_config('heat_api_cfn/bind_port').with_value( params[:bind_port] ) }
23
-      it { should contain_heat_config('heat_api_cfn/workers').with_value( params[:workers] ) }
21
+      it { is_expected.to contain_heat_config('heat_api_cfn/bind_host').with_value( params[:bind_host] ) }
22
+      it { is_expected.to contain_heat_config('heat_api_cfn/bind_port').with_value( params[:bind_port] ) }
23
+      it { is_expected.to contain_heat_config('heat_api_cfn/workers').with_value( params[:workers] ) }
24 24
 
25 25
     end
26 26
 
@@ -33,8 +33,8 @@ describe 'heat::api_cfn' do
33 33
         }
34 34
       end
35 35
 
36
-      it { should contain_heat_config('heat_api_cfn/cert_file').with_value('/path/to/cert') }
37
-      it { should contain_heat_config('heat_api_cfn/key_file').with_value('/path/to/key') }
36
+      it { is_expected.to contain_heat_config('heat_api_cfn/cert_file').with_value('/path/to/cert') }
37
+      it { is_expected.to contain_heat_config('heat_api_cfn/key_file').with_value('/path/to/key') }
38 38
     end
39 39
 
40 40
     context 'with SSL socket options set with wrong parameters' do
@@ -57,8 +57,8 @@ describe 'heat::api_cfn' do
57 57
         }
58 58
       end
59 59
 
60
-      it { should contain_heat_config('heat_api_cfn/cert_file').with_ensure('absent') }
61
-      it { should contain_heat_config('heat_api_cfn/key_file').with_ensure('absent') }
60
+      it { is_expected.to contain_heat_config('heat_api_cfn/cert_file').with_ensure('absent') }
61
+      it { is_expected.to contain_heat_config('heat_api_cfn/key_file').with_ensure('absent') }
62 62
     end
63 63
 
64 64
     [{:enabled => true}, {:enabled => false}].each do |param_hash|
@@ -69,14 +69,14 @@ describe 'heat::api_cfn' do
69 69
 
70 70
         it 'configures heat-api-cfn service' do
71 71
 
72
-          should contain_service('heat-api-cfn').with(
72
+	  is_expected.to contain_service('heat-api-cfn').with(
73 73
             :ensure     => (params[:manage_service] && params[:enabled]) ? 'running' : 'stopped',
74 74
             :name       => platform_params[:api_service_name],
75 75
             :enable     => params[:enabled],
76 76
             :hasstatus  => true,
77
-            :hasrestart => true,
78
-            :subscribe  => ['Exec[heat-dbsync]']
77
+	    :hasrestart => true
79 78
           )
79
+	  is_expected.to contain_service('heat-api-cfn').that_subscribes_to('Exec[heat-dbsync]')
80 80
         end
81 81
       end
82 82
     end
@@ -90,14 +90,14 @@ describe 'heat::api_cfn' do
90 90
 
91 91
       it 'configures heat-api-cfn service' do
92 92
 
93
-        should contain_service('heat-api-cfn').with(
93
+	is_expected.to contain_service('heat-api-cfn').with(
94 94
           :ensure     => nil,
95 95
           :name       => platform_params[:api_service_name],
96 96
           :enable     => false,
97 97
           :hasstatus  => true,
98
-          :hasrestart => true,
99
-          :subscribe  => ['Exec[heat-dbsync]']
98
+	  :hasrestart => true
100 99
         )
100
+	is_expected.to contain_service('heat-api-cfn').that_subscribes_to('Exec[heat-dbsync]')
101 101
       end
102 102
     end
103 103
   end

+ 16
- 16
spec/classes/heat_api_cloudwatch_spec.rb View File

@@ -14,13 +14,13 @@ describe 'heat::api_cloudwatch' do
14 14
 
15 15
     context 'config params' do
16 16
 
17
-      it { should contain_class('heat') }
18
-      it { should contain_class('heat::params') }
19
-      it { should contain_class('heat::policy') }
17
+      it { is_expected.to contain_class('heat') }
18
+      it { is_expected.to contain_class('heat::params') }
19
+      it { is_expected.to contain_class('heat::policy') }
20 20
 
21
-      it { should contain_heat_config('heat_api_cloudwatch/bind_host').with_value( params[:bind_host] ) }
22
-      it { should contain_heat_config('heat_api_cloudwatch/bind_port').with_value( params[:bind_port] ) }
23
-      it { should contain_heat_config('heat_api_cloudwatch/workers').with_value( params[:workers] ) }
21
+      it { is_expected.to contain_heat_config('heat_api_cloudwatch/bind_host').with_value( params[:bind_host] ) }
22
+      it { is_expected.to contain_heat_config('heat_api_cloudwatch/bind_port').with_value( params[:bind_port] ) }
23
+      it { is_expected.to contain_heat_config('heat_api_cloudwatch/workers').with_value( params[:workers] ) }
24 24
 
25 25
     end
26 26
 
@@ -33,8 +33,8 @@ describe 'heat::api_cloudwatch' do
33 33
         }
34 34
       end
35 35
 
36
-      it { should contain_heat_config('heat_api_cloudwatch/cert_file').with_value('/path/to/cert') }
37
-      it { should contain_heat_config('heat_api_cloudwatch/key_file').with_value('/path/to/key') }
36
+      it { is_expected.to contain_heat_config('heat_api_cloudwatch/cert_file').with_value('/path/to/cert') }
37
+      it { is_expected.to contain_heat_config('heat_api_cloudwatch/key_file').with_value('/path/to/key') }
38 38
     end
39 39
 
40 40
     context 'with SSL socket options set with wrong parameters' do
@@ -57,8 +57,8 @@ describe 'heat::api_cloudwatch' do
57 57
         }
58 58
       end
59 59
 
60
-      it { should contain_heat_config('heat_api_cloudwatch/cert_file').with_ensure('absent') }
61
-      it { should contain_heat_config('heat_api_cloudwatch/key_file').with_ensure('absent') }
60
+      it { is_expected.to contain_heat_config('heat_api_cloudwatch/cert_file').with_ensure('absent') }
61
+      it { is_expected.to contain_heat_config('heat_api_cloudwatch/key_file').with_ensure('absent') }
62 62
     end
63 63
 
64 64
     [{:enabled => true}, {:enabled => false}].each do |param_hash|
@@ -69,14 +69,14 @@ describe 'heat::api_cloudwatch' do
69 69
 
70 70
         it 'configures heat-api-cloudwatch service' do
71 71
 
72
-          should contain_service('heat-api-cloudwatch').with(
72
+	  is_expected.to contain_service('heat-api-cloudwatch').with(
73 73
             :ensure     => (params[:manage_service] && params[:enabled]) ? 'running' : 'stopped',
74 74
             :name       => platform_params[:api_service_name],
75 75
             :enable     => params[:enabled],
76 76
             :hasstatus  => true,
77
-            :hasrestart => true,
78
-            :subscribe  => ['Exec[heat-dbsync]']
77
+	    :hasrestart => true
79 78
           )
79
+	  is_expected.to contain_service('heat-api-cloudwatch').that_subscribes_to('Exec[heat-dbsync]')
80 80
         end
81 81
       end
82 82
     end
@@ -90,14 +90,14 @@ describe 'heat::api_cloudwatch' do
90 90
 
91 91
       it 'configures heat-api-cloudwatch service' do
92 92
 
93
-        should contain_service('heat-api-cloudwatch').with(
93
+	is_expected.to contain_service('heat-api-cloudwatch').with(
94 94
           :ensure     => nil,
95 95
           :name       => platform_params[:api_service_name],
96 96
           :enable     => false,
97 97
           :hasstatus  => true,
98
-          :hasrestart => true,
99
-          :subscribe  => ['Exec[heat-dbsync]']
98
+	  :hasrestart => true
100 99
         )
100
+	is_expected.to contain_service('heat-api-cloudwatch').that_subscribes_to('Exec[heat-dbsync]')
101 101
       end
102 102
     end
103 103
   end

+ 15
- 15
spec/classes/heat_api_spec.rb View File

@@ -14,13 +14,13 @@ describe 'heat::api' do
14 14
 
15 15
     context 'config params' do
16 16
 
17
-      it { should contain_class('heat') }
18
-      it { should contain_class('heat::params') }
19
-      it { should contain_class('heat::policy') }
17
+      it { is_expected.to contain_class('heat') }
18
+      it { is_expected.to contain_class('heat::params') }
19
+      it { is_expected.to contain_class('heat::policy') }
20 20
 
21
-      it { should contain_heat_config('heat_api/bind_host').with_value( params[:bind_host] ) }
22
-      it { should contain_heat_config('heat_api/bind_port').with_value( params[:bind_port] ) }
23
-      it { should contain_heat_config('heat_api/workers').with_value( params[:workers] ) }
21
+      it { is_expected.to contain_heat_config('heat_api/bind_host').with_value( params[:bind_host] ) }
22
+      it { is_expected.to contain_heat_config('heat_api/bind_port').with_value( params[:bind_port] ) }
23
+      it { is_expected.to contain_heat_config('heat_api/workers').with_value( params[:workers] ) }
24 24
 
25 25
     end
26 26
 
@@ -33,8 +33,8 @@ describe 'heat::api' do
33 33
         }
34 34
       end
35 35
 
36
-      it { should contain_heat_config('heat_api/cert_file').with_value('/path/to/cert') }
37
-      it { should contain_heat_config('heat_api/key_file').with_value('/path/to/key') }
36
+      it { is_expected.to contain_heat_config('heat_api/cert_file').with_value('/path/to/cert') }
37
+      it { is_expected.to contain_heat_config('heat_api/key_file').with_value('/path/to/key') }
38 38
     end
39 39
 
40 40
     context 'with SSL socket options set with wrong parameters' do
@@ -57,8 +57,8 @@ describe 'heat::api' do
57 57
         }
58 58
       end
59 59
 
60
-      it { should contain_heat_config('heat_api/cert_file').with_ensure('absent') }
61
-      it { should contain_heat_config('heat_api/key_file').with_ensure('absent') }
60
+      it { is_expected.to contain_heat_config('heat_api/cert_file').with_ensure('absent') }
61
+      it { is_expected.to contain_heat_config('heat_api/key_file').with_ensure('absent') }
62 62
     end
63 63
 
64 64
 
@@ -70,15 +70,15 @@ describe 'heat::api' do
70 70
 
71 71
         it 'configures heat-api service' do
72 72
 
73
-          should contain_service('heat-api').with(
73
+	  is_expected.to contain_service('heat-api').with(
74 74
             :ensure     => (params[:manage_service] && params[:enabled]) ? 'running' : 'stopped',
75 75
             :name       => platform_params[:api_service_name],
76 76
             :enable     => params[:enabled],
77 77
             :hasstatus  => true,
78 78
             :hasrestart => true,
79
-            :require    => ['Package[heat-common]', 'Package[heat-api]'],
80
-            :subscribe  => ['Exec[heat-dbsync]']
79
+	    :require    => ['Package[heat-common]', 'Package[heat-api]']
81 80
           )
81
+	  is_expected.to contain_service('heat-api').that_subscribes_to('Exec[heat-dbsync]')
82 82
         end
83 83
       end
84 84
     end
@@ -92,15 +92,15 @@ describe 'heat::api' do
92 92
 
93 93
       it 'configures heat-api service' do
94 94
 
95
-        should contain_service('heat-api').with(
95
+	is_expected.to contain_service('heat-api').with(
96 96
           :ensure     => nil,
97 97
           :name       => platform_params[:api_service_name],
98 98
           :enable     => false,
99 99
           :hasstatus  => true,
100 100
           :hasrestart => true,
101 101
           :require    => ['Package[heat-common]', 'Package[heat-api]'],
102
-          :subscribe  => ['Exec[heat-dbsync]']
103 102
         )
103
+	is_expected.to contain_service('heat-api').that_subscribes_to('Exec[heat-dbsync]')
104 104
       end
105 105
     end
106 106
   end

+ 2
- 2
spec/classes/heat_db_mysql_spec.rb View File

@@ -18,11 +18,11 @@ describe 'heat::db::mysql' do
18 18
 
19 19
     context 'when omiting the required parameter password' do
20 20
       before { params.delete(:password) }
21
-      it { expect { should raise_error(Puppet::Error) } }
21
+      it { expect { is_expected.to raise_error(Puppet::Error) } }
22 22
     end
23 23
 
24 24
     it 'creates a mysql database' do
25
-      should contain_openstacklib__db__mysql( params[:dbname] ).with(
25
+      is_expected.to contain_openstacklib__db__mysql( params[:dbname] ).with(
26 26
         :user          => params[:user],
27 27
         :password_hash => '*58C036CDA51D8E8BBBBF2F9EA5ABF111ADA444F0',
28 28
         :host          => params[:host],

+ 2
- 2
spec/classes/heat_db_postgresql_spec.rb View File

@@ -24,7 +24,7 @@ describe 'heat::db::postgresql' do
24 24
         req_params
25 25
       end
26 26
 
27
-      it { should contain_postgresql__server__db('heat').with(
27
+      it { is_expected.to contain_postgresql__server__db('heat').with(
28 28
         :user     => 'heat',
29 29
         :password => 'md5fd5c4fca491370aab732f903e2fb7c99'
30 30
       )}
@@ -47,7 +47,7 @@ describe 'heat::db::postgresql' do
47 47
         req_params
48 48
       end
49 49
 
50
-      it { should contain_postgresql__server__db('heat').with(
50
+      it { is_expected.to contain_postgresql__server__db('heat').with(
51 51
         :user     => 'heat',
52 52
         :password => 'md5fd5c4fca491370aab732f903e2fb7c99'
53 53
       )}

+ 13
- 13
spec/classes/heat_engine_spec.rb View File

@@ -42,9 +42,9 @@ describe 'heat::engine' do
42 42
         default_params.merge(params)
43 43
       end
44 44
 
45
-      it { should contain_package('heat-engine').with_name(os_params[:package_name]) }
45
+      it { is_expected.to contain_package('heat-engine').with_name(os_params[:package_name]) }
46 46
 
47
-      it { should contain_service('heat-engine').with(
47
+      it { is_expected.to contain_service('heat-engine').with(
48 48
         :ensure     => (expected_params[:manage_service] && expected_params[:enabled]) ? 'running' : 'stopped',
49 49
         :name       => os_params[:service_name],
50 50
         :enable     => expected_params[:enabled],
@@ -56,20 +56,20 @@ describe 'heat::engine' do
56 56
         :subscribe  => 'Exec[heat-dbsync]'
57 57
       ) }
58 58
 
59
-      it { should contain_heat_config('DEFAULT/auth_encryption_key').with_value( expected_params[:auth_encryption_key] ) }
60
-      it { should contain_heat_config('DEFAULT/heat_stack_user_role').with_value( expected_params[:heat_stack_user_role] ) }
61
-      it { should contain_heat_config('DEFAULT/heat_metadata_server_url').with_value( expected_params[:heat_metadata_server_url] ) }
62
-      it { should contain_heat_config('DEFAULT/heat_waitcondition_server_url').with_value( expected_params[:heat_waitcondition_server_url] ) }
63
-      it { should contain_heat_config('DEFAULT/heat_watch_server_url').with_value( expected_params[:heat_watch_server_url] ) }
64
-      it { should contain_heat_config('DEFAULT/engine_life_check_timeout').with_value( expected_params[:engine_life_check_timeout] ) }
65
-      it { should contain_heat_config('DEFAULT/trusts_delegated_roles').with_value( expected_params[:trusts_delegated_roles] ) }
66
-      it { should contain_heat_config('DEFAULT/deferred_auth_method').with_value( expected_params[:deferred_auth_method] ) }
59
+      it { is_expected.to contain_heat_config('DEFAULT/auth_encryption_key').with_value( expected_params[:auth_encryption_key] ) }
60
+      it { is_expected.to contain_heat_config('DEFAULT/heat_stack_user_role').with_value( expected_params[:heat_stack_user_role] ) }
61
+      it { is_expected.to contain_heat_config('DEFAULT/heat_metadata_server_url').with_value( expected_params[:heat_metadata_server_url] ) }
62
+      it { is_expected.to contain_heat_config('DEFAULT/heat_waitcondition_server_url').with_value( expected_params[:heat_waitcondition_server_url] ) }
63
+      it { is_expected.to contain_heat_config('DEFAULT/heat_watch_server_url').with_value( expected_params[:heat_watch_server_url] ) }
64
+      it { is_expected.to contain_heat_config('DEFAULT/engine_life_check_timeout').with_value( expected_params[:engine_life_check_timeout] ) }
65
+      it { is_expected.to contain_heat_config('DEFAULT/trusts_delegated_roles').with_value( expected_params[:trusts_delegated_roles] ) }
66
+      it { is_expected.to contain_heat_config('DEFAULT/deferred_auth_method').with_value( expected_params[:deferred_auth_method] ) }
67 67
 
68 68
       it 'configures delegated roles' do
69
-        should contain_keystone_role("role1").with(
69
+	is_expected.to contain_keystone_role("role1").with(
70 70
           :ensure  => 'present'
71 71
         )
72
-        should contain_keystone_role("role2").with(
72
+	is_expected.to contain_keystone_role("role2").with(
73 73
           :ensure  => 'present'
74 74
         )
75 75
       end
@@ -82,7 +82,7 @@ describe 'heat::engine' do
82 82
           :enabled        => false })
83 83
       end
84 84
 
85
-      it { should contain_service('heat-engine').with(
85
+      it { is_expected.to contain_service('heat-engine').with(
86 86
         :ensure     => nil,
87 87
         :name       => os_params[:service_name],
88 88
         :enable     => false,

+ 104
- 104
spec/classes/heat_init_spec.rb View File

@@ -75,17 +75,17 @@ describe 'heat' do
75 75
 
76 76
   shared_examples_for 'a heat base installation' do
77 77
 
78
-    it { should contain_class('heat::params') }
78
+    it { is_expected.to contain_class('heat::params') }
79 79
 
80 80
     it 'configures heat group' do
81
-      should contain_group('heat').with(
81
+      is_expected.to contain_group('heat').with(
82 82
         :name    => 'heat',
83 83
         :require => 'Package[heat-common]'
84 84
       )
85 85
     end
86 86
 
87 87
     it 'configures heat user' do
88
-      should contain_user('heat').with(
88
+      is_expected.to contain_user('heat').with(
89 89
         :name    => 'heat',
90 90
         :gid     => 'heat',
91 91
         :groups  => ['heat'],
@@ -95,7 +95,7 @@ describe 'heat' do
95 95
     end
96 96
 
97 97
     it 'configures heat configuration folder' do
98
-      should contain_file('/etc/heat/').with(
98
+      is_expected.to contain_file('/etc/heat/').with(
99 99
         :ensure  => 'directory',
100 100
         :owner   => 'heat',
101 101
         :group   => 'heat',
@@ -105,7 +105,7 @@ describe 'heat' do
105 105
     end
106 106
 
107 107
     it 'configures heat configuration file' do
108
-      should contain_file('/etc/heat/heat.conf').with(
108
+      is_expected.to contain_file('/etc/heat/heat.conf').with(
109 109
         :owner   => 'heat',
110 110
         :group   => 'heat',
111 111
         :mode    => '0640',
@@ -114,7 +114,7 @@ describe 'heat' do
114 114
     end
115 115
 
116 116
     it 'installs heat common package' do
117
-      should contain_package('heat-common').with(
117
+      is_expected.to contain_package('heat-common').with(
118 118
         :ensure => 'present',
119 119
         :name   => platform_params[:common_package_name]
120 120
       )
@@ -122,47 +122,47 @@ describe 'heat' do
122 122
 
123 123
 
124 124
     it 'configures debug and verbose' do
125
-      should contain_heat_config('DEFAULT/debug').with_value( params[:debug] )
126
-      should contain_heat_config('DEFAULT/verbose').with_value( params[:verbose] )
125
+      is_expected.to contain_heat_config('DEFAULT/debug').with_value( params[:debug] )
126
+      is_expected.to contain_heat_config('DEFAULT/verbose').with_value( params[:verbose] )
127 127
     end
128 128
 
129 129
     it 'configures auth_uri' do
130
-      should contain_heat_config('keystone_authtoken/auth_uri').with_value( params[:auth_uri] )
130
+      is_expected.to contain_heat_config('keystone_authtoken/auth_uri').with_value( params[:auth_uri] )
131 131
     end
132 132
 
133 133
     it 'configures logging directory by default' do
134
-      should contain_heat_config('DEFAULT/log_dir').with_value( params[:log_dir] )
134
+      is_expected.to contain_heat_config('DEFAULT/log_dir').with_value( params[:log_dir] )
135 135
     end
136 136
 
137 137
     context 'with logging directory disabled' do
138 138
       before { params.merge!( :log_dir => false) }
139 139
 
140
-      it { should contain_heat_config('DEFAULT/log_dir').with_ensure('absent') }
140
+      it { is_expected.to contain_heat_config('DEFAULT/log_dir').with_ensure('absent') }
141 141
     end
142 142
 
143 143
     it 'configures database_connection' do
144
-      should contain_heat_config('database/connection').with_value( params[:database_connection] )
144
+      is_expected.to contain_heat_config('database/connection').with_value( params[:database_connection] )
145 145
     end
146 146
 
147 147
     it 'configures database_idle_timeout' do
148
-      should contain_heat_config('database/idle_timeout').with_value( params[:database_idle_timeout] )
148
+      is_expected.to contain_heat_config('database/idle_timeout').with_value( params[:database_idle_timeout] )
149 149
     end
150 150
 
151 151
     context("failing if database_connection is invalid") do
152 152
       before { params[:database_connection] = 'foo://foo:bar@baz/moo' }
153
-      it { expect { should raise_error(Puppet::Error) } }
153
+      it { expect { is_expected.to raise_error(Puppet::Error) } }
154 154
     end
155 155
 
156 156
     context("with deprecated sql_connection parameter") do
157 157
       before { params[:sql_connection] = 'mysql://a:b@c/d' }
158
-      it { should contain_heat_config('database/connection').with_value( params[:sql_connection] )}
158
+      it { is_expected.to contain_heat_config('database/connection').with_value( params[:sql_connection] )}
159 159
     end
160 160
 
161 161
     it 'configures keystone_ec2_uri' do
162
-      should contain_heat_config('ec2authtoken/auth_uri').with_value( params[:keystone_ec2_uri] )
162
+      is_expected.to contain_heat_config('ec2authtoken/auth_uri').with_value( params[:keystone_ec2_uri] )
163 163
     end
164 164
 
165
-    it { should contain_heat_config('paste_deploy/flavor').with_value('keystone') }
165
+    it { is_expected.to contain_heat_config('paste_deploy/flavor').with_value('keystone') }
166 166
 
167 167
     it 'keeps keystone secrets secret' do
168 168
       should contain_heat_config('keystone_authtoken/admin_password').with_secret(true)
@@ -173,88 +173,88 @@ describe 'heat' do
173 173
 
174 174
   shared_examples_for 'rabbit without HA support (with backward compatibility)' do
175 175
     it 'configures rabbit' do
176
-      should contain_heat_config('DEFAULT/rabbit_userid').with_value( params[:rabbit_userid] )
177
-      should contain_heat_config('DEFAULT/rabbit_password').with_value( params[:rabbit_password] )
178
-      should contain_heat_config('DEFAULT/rabbit_password').with_secret( true )
179
-      should contain_heat_config('DEFAULT/rabbit_virtual_host').with_value( params[:rabbit_virtual_host] )
180
-      should contain_heat_config('DEFAULT/rabbit_use_ssl').with_value(false)
181
-      should contain_heat_config('DEFAULT/kombu_ssl_ca_certs').with_ensure('absent')
182
-      should contain_heat_config('DEFAULT/kombu_ssl_certfile').with_ensure('absent')
183
-      should contain_heat_config('DEFAULT/kombu_ssl_keyfile').with_ensure('absent')
184
-      should contain_heat_config('DEFAULT/kombu_ssl_version').with_ensure('absent')
185
-    end
186
-    it { should contain_heat_config('DEFAULT/rabbit_host').with_value( params[:rabbit_host] ) }
187
-    it { should contain_heat_config('DEFAULT/rabbit_port').with_value( params[:rabbit_port] ) }
188
-    it { should contain_heat_config('DEFAULT/rabbit_hosts').with_value( "#{params[:rabbit_host]}:#{params[:rabbit_port]}" ) }
189
-    it { should contain_heat_config('DEFAULT/rabbit_ha_queues').with_value('false') }
190
-    it { should contain_heat_config('DEFAULT/amqp_durable_queues').with_value(false) }
176
+      is_expected.to contain_heat_config('DEFAULT/rabbit_userid').with_value( params[:rabbit_userid] )
177
+      is_expected.to contain_heat_config('DEFAULT/rabbit_password').with_value( params[:rabbit_password] )
178
+      is_expected.to contain_heat_config('DEFAULT/rabbit_password').with_secret( true )
179
+      is_expected.to contain_heat_config('DEFAULT/rabbit_virtual_host').with_value( params[:rabbit_virtual_host] )
180
+      is_expected.to contain_heat_config('DEFAULT/rabbit_use_ssl').with_value(false)
181
+      is_expected.to contain_heat_config('DEFAULT/kombu_ssl_ca_certs').with_ensure('absent')
182
+      is_expected.to contain_heat_config('DEFAULT/kombu_ssl_certfile').with_ensure('absent')
183
+      is_expected.to contain_heat_config('DEFAULT/kombu_ssl_keyfile').with_ensure('absent')
184
+      is_expected.to contain_heat_config('DEFAULT/kombu_ssl_version').with_ensure('absent')
185
+    end
186
+    it { is_expected.to contain_heat_config('DEFAULT/rabbit_host').with_value( params[:rabbit_host] ) }
187
+    it { is_expected.to contain_heat_config('DEFAULT/rabbit_port').with_value( params[:rabbit_port] ) }
188
+    it { is_expected.to contain_heat_config('DEFAULT/rabbit_hosts').with_value( "#{params[:rabbit_host]}:#{params[:rabbit_port]}" ) }
189
+    it { is_expected.to contain_heat_config('DEFAULT/rabbit_ha_queues').with_value('false') }
190
+    it { is_expected.to contain_heat_config('DEFAULT/amqp_durable_queues').with_value(false) }
191 191
   end
192 192
 
193 193
   shared_examples_for 'rabbit without HA support (without backward compatibility)' do
194 194
     it 'configures rabbit' do
195
-      should contain_heat_config('DEFAULT/rabbit_userid').with_value( params[:rabbit_userid] )
196
-      should contain_heat_config('DEFAULT/rabbit_password').with_secret( true )
197
-      should contain_heat_config('DEFAULT/rabbit_password').with_value( params[:rabbit_password] )
198
-      should contain_heat_config('DEFAULT/rabbit_virtual_host').with_value( params[:rabbit_virtual_host] )
199
-      should contain_heat_config('DEFAULT/rabbit_use_ssl').with_value(false)
200
-      should contain_heat_config('DEFAULT/kombu_ssl_ca_certs').with_ensure('absent')
201
-      should contain_heat_config('DEFAULT/kombu_ssl_certfile').with_ensure('absent')
202
-      should contain_heat_config('DEFAULT/kombu_ssl_keyfile').with_ensure('absent')
203
-      should contain_heat_config('DEFAULT/kombu_ssl_version').with_ensure('absent')
204
-    end
205
-    it { should contain_heat_config('DEFAULT/rabbit_host').with_ensure('absent') }
206
-    it { should contain_heat_config('DEFAULT/rabbit_port').with_ensure('absent') }
207
-    it { should contain_heat_config('DEFAULT/rabbit_hosts').with_value( params[:rabbit_hosts].join(',') ) }
208
-    it { should contain_heat_config('DEFAULT/rabbit_ha_queues').with_value('false') }
209
-    it { should contain_heat_config('DEFAULT/amqp_durable_queues').with_value(false) }
195
+      is_expected.to contain_heat_config('DEFAULT/rabbit_userid').with_value( params[:rabbit_userid] )
196
+      is_expected.to contain_heat_config('DEFAULT/rabbit_password').with_secret( true )
197
+      is_expected.to contain_heat_config('DEFAULT/rabbit_password').with_value( params[:rabbit_password] )
198
+      is_expected.to contain_heat_config('DEFAULT/rabbit_virtual_host').with_value( params[:rabbit_virtual_host] )
199
+      is_expected.to contain_heat_config('DEFAULT/rabbit_use_ssl').with_value(false)
200
+      is_expected.to contain_heat_config('DEFAULT/kombu_ssl_ca_certs').with_ensure('absent')
201
+      is_expected.to contain_heat_config('DEFAULT/kombu_ssl_certfile').with_ensure('absent')
202
+      is_expected.to contain_heat_config('DEFAULT/kombu_ssl_keyfile').with_ensure('absent')
203
+      is_expected.to contain_heat_config('DEFAULT/kombu_ssl_version').with_ensure('absent')
204
+    end
205
+    it { is_expected.to contain_heat_config('DEFAULT/rabbit_host').with_ensure('absent') }
206
+    it { is_expected.to contain_heat_config('DEFAULT/rabbit_port').with_ensure('absent') }
207
+    it { is_expected.to contain_heat_config('DEFAULT/rabbit_hosts').with_value( params[:rabbit_hosts].join(',') ) }
208
+    it { is_expected.to contain_heat_config('DEFAULT/rabbit_ha_queues').with_value('false') }
209
+    it { is_expected.to contain_heat_config('DEFAULT/amqp_durable_queues').with_value(false) }
210 210
   end
211 211
 
212 212
   shared_examples_for 'rabbit with HA support' do
213 213
     it 'configures rabbit' do
214
-      should contain_heat_config('DEFAULT/rabbit_userid').with_value( params[:rabbit_userid] )
215
-      should contain_heat_config('DEFAULT/rabbit_password').with_value( params[:rabbit_password] )
216
-      should contain_heat_config('DEFAULT/rabbit_password').with_secret( true )
217
-      should contain_heat_config('DEFAULT/rabbit_virtual_host').with_value( params[:rabbit_virtual_host] )
218
-      should contain_heat_config('DEFAULT/rabbit_use_ssl').with_value(false)
219
-      should contain_heat_config('DEFAULT/kombu_ssl_ca_certs').with_ensure('absent')
220
-      should contain_heat_config('DEFAULT/kombu_ssl_certfile').with_ensure('absent')
221
-      should contain_heat_config('DEFAULT/kombu_ssl_keyfile').with_ensure('absent')
222
-      should contain_heat_config('DEFAULT/kombu_ssl_version').with_ensure('absent')
223
-    end
224
-    it { should contain_heat_config('DEFAULT/rabbit_host').with_ensure('absent') }
225
-    it { should contain_heat_config('DEFAULT/rabbit_port').with_ensure('absent') }
226
-    it { should contain_heat_config('DEFAULT/rabbit_hosts').with_value( params[:rabbit_hosts].join(',') ) }
227
-    it { should contain_heat_config('DEFAULT/rabbit_ha_queues').with_value('true') }
228
-    it { should contain_heat_config('DEFAULT/amqp_durable_queues').with_value(true) }
214
+      is_expected.to contain_heat_config('DEFAULT/rabbit_userid').with_value( params[:rabbit_userid] )
215
+      is_expected.to contain_heat_config('DEFAULT/rabbit_password').with_value( params[:rabbit_password] )
216
+      is_expected.to contain_heat_config('DEFAULT/rabbit_password').with_secret( true )
217
+      is_expected.to contain_heat_config('DEFAULT/rabbit_virtual_host').with_value( params[:rabbit_virtual_host] )
218
+      is_expected.to contain_heat_config('DEFAULT/rabbit_use_ssl').with_value(false)
219
+      is_expected.to contain_heat_config('DEFAULT/kombu_ssl_ca_certs').with_ensure('absent')
220
+      is_expected.to contain_heat_config('DEFAULT/kombu_ssl_certfile').with_ensure('absent')
221
+      is_expected.to contain_heat_config('DEFAULT/kombu_ssl_keyfile').with_ensure('absent')
222
+      is_expected.to contain_heat_config('DEFAULT/kombu_ssl_version').with_ensure('absent')
223
+    end
224
+    it { is_expected.to contain_heat_config('DEFAULT/rabbit_host').with_ensure('absent') }
225
+    it { is_expected.to contain_heat_config('DEFAULT/rabbit_port').with_ensure('absent') }
226
+    it { is_expected.to contain_heat_config('DEFAULT/rabbit_hosts').with_value( params[:rabbit_hosts].join(',') ) }
227
+    it { is_expected.to contain_heat_config('DEFAULT/rabbit_ha_queues').with_value('true') }
228
+    it { is_expected.to contain_heat_config('DEFAULT/amqp_durable_queues').with_value(true) }
229 229
   end
230 230
 
231 231
 
232 232
   shared_examples_for 'qpid as rpc backend' do
233 233
     context("with default parameters") do
234
-      it { should contain_heat_config('DEFAULT/qpid_reconnect').with_value(true) }
235
-      it { should contain_heat_config('DEFAULT/qpid_reconnect_timeout').with_value('0') }
236
-      it { should contain_heat_config('DEFAULT/qpid_reconnect_limit').with_value('0') }
237
-      it { should contain_heat_config('DEFAULT/qpid_reconnect_interval_min').with_value('0') }
238
-      it { should contain_heat_config('DEFAULT/qpid_reconnect_interval_max').with_value('0') }
239
-      it { should contain_heat_config('DEFAULT/qpid_reconnect_interval').with_value('0') }
240
-      it { should contain_heat_config('DEFAULT/qpid_heartbeat').with_value('60') }
241
-      it { should contain_heat_config('DEFAULT/qpid_protocol').with_value('tcp') }
242
-      it { should contain_heat_config('DEFAULT/qpid_tcp_nodelay').with_value(true) }
243
-      it { should contain_heat_config('DEFAULT/amqp_durable_queues').with_value(false) }
234
+      it { is_expected.to contain_heat_config('DEFAULT/qpid_reconnect').with_value(true) }
235
+      it { is_expected.to contain_heat_config('DEFAULT/qpid_reconnect_timeout').with_value('0') }
236
+      it { is_expected.to contain_heat_config('DEFAULT/qpid_reconnect_limit').with_value('0') }
237
+      it { is_expected.to contain_heat_config('DEFAULT/qpid_reconnect_interval_min').with_value('0') }
238
+      it { is_expected.to contain_heat_config('DEFAULT/qpid_reconnect_interval_max').with_value('0') }
239
+      it { is_expected.to contain_heat_config('DEFAULT/qpid_reconnect_interval').with_value('0') }
240
+      it { is_expected.to contain_heat_config('DEFAULT/qpid_heartbeat').with_value('60') }
241
+      it { is_expected.to contain_heat_config('DEFAULT/qpid_protocol').with_value('tcp') }
242
+      it { is_expected.to contain_heat_config('DEFAULT/qpid_tcp_nodelay').with_value(true) }
243
+      it { is_expected.to contain_heat_config('DEFAULT/amqp_durable_queues').with_value(false) }
244 244
     end
245 245
 
246 246
     context("with mandatory parameters set") do
247
-      it { should contain_heat_config('DEFAULT/rpc_backend').with_value('heat.openstack.common.rpc.impl_qpid') }
248
-      it { should contain_heat_config('DEFAULT/qpid_hostname').with_value( params[:qpid_hostname] ) }
249
-      it { should contain_heat_config('DEFAULT/qpid_port').with_value( params[:qpid_port] ) }
250
-      it { should contain_heat_config('DEFAULT/qpid_username').with_value( params[:qpid_username]) }
251
-      it { should contain_heat_config('DEFAULT/qpid_password').with_value(params[:qpid_password]) }
252
-      it { should contain_heat_config('DEFAULT/qpid_password').with_secret( true ) }
247
+      it { is_expected.to contain_heat_config('DEFAULT/rpc_backend').with_value('heat.openstack.common.rpc.impl_qpid') }
248
+      it { is_expected.to contain_heat_config('DEFAULT/qpid_hostname').with_value( params[:qpid_hostname] ) }
249
+      it { is_expected.to contain_heat_config('DEFAULT/qpid_port').with_value( params[:qpid_port] ) }
250
+      it { is_expected.to contain_heat_config('DEFAULT/qpid_username').with_value( params[:qpid_username]) }
251
+      it { is_expected.to contain_heat_config('DEFAULT/qpid_password').with_value(params[:qpid_password]) }
252
+      it { is_expected.to contain_heat_config('DEFAULT/qpid_password').with_secret( true ) }
253 253
     end
254 254
 
255 255
     context("failing if the rpc_backend is not present") do
256 256
       before { params.delete( :rpc_backend) }
257
-      it { expect { should raise_error(Puppet::Error) } }
257
+      it { expect { is_expected.to raise_error(Puppet::Error) } }
258 258
     end
259 259
   end
260 260
 
@@ -270,11 +270,11 @@ describe 'heat' do
270 270
     end
271 271
 
272 272
     it do
273
-      should contain_heat_config('DEFAULT/rabbit_use_ssl').with_value('true')
274
-      should contain_heat_config('DEFAULT/kombu_ssl_ca_certs').with_value('/path/to/ssl/ca/certs')
275
-      should contain_heat_config('DEFAULT/kombu_ssl_certfile').with_value('/path/to/ssl/cert/file')
276
-      should contain_heat_config('DEFAULT/kombu_ssl_keyfile').with_value('/path/to/ssl/keyfile')
277
-      should contain_heat_config('DEFAULT/kombu_ssl_version').with_value('TLSv1')
273
+      is_expected.to contain_heat_config('DEFAULT/rabbit_use_ssl').with_value('true')
274
+      is_expected.to contain_heat_config('DEFAULT/kombu_ssl_ca_certs').with_value('/path/to/ssl/ca/certs')
275
+      is_expected.to contain_heat_config('DEFAULT/kombu_ssl_certfile').with_value('/path/to/ssl/cert/file')
276
+      is_expected.to contain_heat_config('DEFAULT/kombu_ssl_keyfile').with_value('/path/to/ssl/keyfile')
277
+      is_expected.to contain_heat_config('DEFAULT/kombu_ssl_version').with_value('TLSv1')
278 278
     end
279 279
   end
280 280
 
@@ -286,11 +286,11 @@ describe 'heat' do
286 286
     end
287 287
 
288 288
     it do
289
-      should contain_heat_config('DEFAULT/rabbit_use_ssl').with_value('true')
290
-      should contain_heat_config('DEFAULT/kombu_ssl_ca_certs').with_ensure('absent')
291
-      should contain_heat_config('DEFAULT/kombu_ssl_certfile').with_ensure('absent')
292
-      should contain_heat_config('DEFAULT/kombu_ssl_keyfile').with_ensure('absent')
293
-      should contain_heat_config('DEFAULT/kombu_ssl_version').with_value('TLSv1')
289
+      is_expected.to contain_heat_config('DEFAULT/rabbit_use_ssl').with_value('true')
290
+      is_expected.to contain_heat_config('DEFAULT/kombu_ssl_ca_certs').with_ensure('absent')
291
+      is_expected.to contain_heat_config('DEFAULT/kombu_ssl_certfile').with_ensure('absent')
292
+      is_expected.to contain_heat_config('DEFAULT/kombu_ssl_keyfile').with_ensure('absent')
293
+      is_expected.to contain_heat_config('DEFAULT/kombu_ssl_version').with_value('TLSv1')
294 294
     end
295 295
   end
296 296
 
@@ -303,11 +303,11 @@ describe 'heat' do
303 303
     end
304 304
 
305 305
     it do
306
-      should contain_heat_config('DEFAULT/rabbit_use_ssl').with_value('false')
307
-      should contain_heat_config('DEFAULT/kombu_ssl_ca_certs').with_ensure('absent')
308
-      should contain_heat_config('DEFAULT/kombu_ssl_certfile').with_ensure('absent')
309
-      should contain_heat_config('DEFAULT/kombu_ssl_keyfile').with_ensure('absent')
310
-      should contain_heat_config('DEFAULT/kombu_ssl_version').with_ensure('absent')
306
+      is_expected.to contain_heat_config('DEFAULT/rabbit_use_ssl').with_value('false')
307
+      is_expected.to contain_heat_config('DEFAULT/kombu_ssl_ca_certs').with_ensure('absent')
308
+      is_expected.to contain_heat_config('DEFAULT/kombu_ssl_certfile').with_ensure('absent')
309
+      is_expected.to contain_heat_config('DEFAULT/kombu_ssl_keyfile').with_ensure('absent')
310
+      is_expected.to contain_heat_config('DEFAULT/kombu_ssl_version').with_ensure('absent')
311 311
     end
312 312
   end
313 313
 
@@ -339,7 +339,7 @@ describe 'heat' do
339 339
   end
340 340
 
341 341
   shared_examples_for 'with syslog disabled' do
342
-    it { should contain_heat_config('DEFAULT/use_syslog').with_value(false) }
342
+    it { is_expected.to contain_heat_config('DEFAULT/use_syslog').with_value(false) }
343 343
   end
344 344
 
345 345
   shared_examples_for 'with syslog enabled' do
@@ -350,8 +350,8 @@ describe 'heat' do
350 350
     end
351 351
 
352 352
     it do
353
-      should contain_heat_config('DEFAULT/use_syslog').with_value(true)
354
-      should contain_heat_config('DEFAULT/syslog_log_facility').with_value('LOG_USER')
353
+      is_expected.to contain_heat_config('DEFAULT/use_syslog').with_value(true)
354
+      is_expected.to contain_heat_config('DEFAULT/syslog_log_facility').with_value('LOG_USER')
355 355
     end
356 356
   end
357 357
 
@@ -364,8 +364,8 @@ describe 'heat' do
364 364
     end
365 365
 
366 366
     it do
367
-      should contain_heat_config('DEFAULT/use_syslog').with_value(true)
368
-      should contain_heat_config('DEFAULT/syslog_log_facility').with_value('LOG_LOCAL0')
367
+      is_expected.to contain_heat_config('DEFAULT/use_syslog').with_value(true)
368
+      is_expected.to contain_heat_config('DEFAULT/syslog_log_facility').with_value('LOG_LOCAL0')
369 369
     end
370 370
   end
371 371
 
@@ -377,7 +377,7 @@ describe 'heat' do
377 377
     end
378 378
 
379 379
     it do
380
-      should contain_heat_config('database/idle_timeout').with_value(69)
380
+      is_expected.to contain_heat_config('database/idle_timeout').with_value(69)
381 381
     end
382 382
   end
383 383
 
@@ -389,7 +389,7 @@ describe 'heat' do
389 389
     end
390 390
 
391 391
     it do
392
-      should contain_heat_config('ec2authtoken/auth_uri').with_value('http://1.2.3.4:35357/v2.0/ec2tokens')
392
+      is_expected.to contain_heat_config('ec2authtoken/auth_uri').with_value('http://1.2.3.4:35357/v2.0/ec2tokens')
393 393
     end
394 394
   end
395 395
 
@@ -401,7 +401,7 @@ describe 'heat' do
401 401
     end
402 402
 
403 403
     it do
404
-      should contain_heat_config('keystone_authtoken/auth_uri').with_value('http://1.2.3.4:35357/v2.0')
404
+      is_expected.to contain_heat_config('keystone_authtoken/auth_uri').with_value('http://1.2.3.4:35357/v2.0')
405 405
     end
406 406
   end
407 407
 
@@ -413,13 +413,13 @@ describe 'heat' do
413 413
     end
414 414
 
415 415
     it 'has region_name set when specified' do
416
-      should contain_heat_config('DEFAULT/region_name_for_services').with_value('East')
416
+      is_expected.to contain_heat_config('DEFAULT/region_name_for_services').with_value('East')
417 417
     end
418 418
   end
419 419
 
420 420
   shared_examples_for 'without region_name set' do
421 421
     it 'doesnt have region_name set by default' do
422
-      should contain_heat_config('DEFAULT/region_name_for_services').with_enure('absent')
422
+      is_expected.to contain_heat_config('DEFAULT/region_name_for_services').with_enure('absent')
423 423
     end
424 424
   end
425 425
 

+ 15
- 15
spec/classes/heat_keystone_auth_cfn_spec.rb View File

@@ -26,11 +26,11 @@ describe 'heat::keystone::auth_cfn' do
26 26
 
27 27
     context 'without the required password parameter' do
28 28
       before { params.delete(:password) }
29
-      it { expect { should raise_error(Puppet::Error) } }
29
+      it { expect { is_expected.to raise_error(Puppet::Error) } }
30 30
     end
31 31
 
32 32
     it 'configures heat user' do
33
-      should contain_keystone_user( params[:auth_name] ).with(
33
+      is_expected.to contain_keystone_user( params[:auth_name] ).with(
34 34
         :ensure   => 'present',
35 35
         :password => params[:password],
36 36
         :email    => params[:email],
@@ -39,14 +39,14 @@ describe 'heat::keystone::auth_cfn' do
39 39
     end
40 40
 
41 41
     it 'configures heat user roles' do
42
-      should contain_keystone_user_role("#{params[:auth_name]}@#{params[:tenant]}").with(
42
+      is_expected.to contain_keystone_user_role("#{params[:auth_name]}@#{params[:tenant]}").with(
43 43
         :ensure  => 'present',
44 44
         :roles   => ['admin']
45 45
       )
46 46
     end
47 47
 
48 48
     it 'configures heat service' do
49
-      should contain_keystone_service( params[:auth_name] ).with(
49
+      is_expected.to contain_keystone_service( params[:auth_name] ).with(
50 50
         :ensure      => 'present',
51 51
         :type        => params[:service_type],
52 52
         :description => 'Openstack Cloudformation Service'
@@ -54,7 +54,7 @@ describe 'heat::keystone::auth_cfn' do
54 54
     end
55 55
 
56 56
     it 'configure heat endpoints' do
57
-      should contain_keystone_endpoint("#{params[:region]}/#{params[:auth_name]}").with(
57
+      is_expected.to contain_keystone_endpoint("#{params[:region]}/#{params[:auth_name]}").with(
58 58
         :ensure       => 'present',
59 59
         :public_url   => "#{params[:public_protocol]}://#{params[:public_address]}:#{params[:port]}/#{params[:version]}/",
60 60
         :admin_url    => "#{params[:admin_protocol]}://#{params[:admin_address]}:#{params[:port]}/#{params[:version]}/",
@@ -86,16 +86,16 @@ describe 'heat::keystone::auth_cfn' do
86 86
       })
87 87
     end
88 88
     it 'configures correct user name' do
89
-      should contain_keystone_user('heat-cfn')
89
+      is_expected.to contain_keystone_user('heat-cfn')
90 90
     end
91 91
     it 'configures correct user role' do
92
-      should contain_keystone_user_role('heat-cfn@services')
92
+      is_expected.to contain_keystone_user_role('heat-cfn@services')
93 93
     end
94 94
     it 'configures correct service name' do
95
-      should contain_keystone_service('heat-cfn_service')
95
+      is_expected.to contain_keystone_service('heat-cfn_service')
96 96
     end
97 97
     it 'configures correct endpoint name' do
98
-      should contain_keystone_endpoint('RegionOne/heat-cfn_service')
98
+      is_expected.to contain_keystone_endpoint('RegionOne/heat-cfn_service')
99 99
     end
100 100
   end
101 101
 
@@ -104,10 +104,10 @@ describe 'heat::keystone::auth_cfn' do
104 104
       params.merge!( :configure_user => false )
105 105
     end
106 106
 
107
-    it { should_not contain_keystone_user('heat_cfn') }
108
-    it { should contain_keystone_user_role('heat-cfn@services') }
107
+    it { is_expected.to_not contain_keystone_user('heat_cfn') }
108
+    it { is_expected.to contain_keystone_user_role('heat-cfn@services') }
109 109
 
110
-    it { should contain_keystone_service('heat-cfn').with(
110
+    it { is_expected.to contain_keystone_service('heat-cfn').with(
111 111
       :ensure       => 'present',
112 112
       :type         => 'cloudformation',
113 113
       :description  => 'Openstack Cloudformation Service'
@@ -122,10 +122,10 @@ describe 'heat::keystone::auth_cfn' do
122 122
       )
123 123
     end
124 124
 
125
-    it { should_not contain_keystone_user('heat_cfn') }
126
-    it { should_not contain_keystone_user_role('heat-cfn@services') }
125
+    it { is_expected.to_not contain_keystone_user('heat_cfn') }
126
+    it { is_expected.to_not contain_keystone_user_role('heat-cfn@services') }
127 127
 
128
-    it { should contain_keystone_service('heat-cfn').with(
128
+    it { is_expected.to contain_keystone_service('heat-cfn').with(
129 129
       :ensure       => 'present',
130 130
       :type         => 'cloudformation',
131 131
       :description  => 'Openstack Cloudformation Service'

+ 19
- 22
spec/classes/heat_keystone_auth_spec.rb View File

@@ -27,11 +27,11 @@ describe 'heat::keystone::auth' do
27 27
 
28 28
     context 'without the required password parameter' do
29 29
       before { params.delete(:password) }
30
-      it { expect { should raise_error(Puppet::Error) } }
30
+      it { expect { is_expected.to raise_error(Puppet::Error) } }
31 31
     end
32 32
 
33 33
     it 'configures heat user' do
34
-      should contain_keystone_user( params[:auth_name] ).with(
34
+      is_expected.to contain_keystone_user( params[:auth_name] ).with(
35 35
         :ensure   => 'present',
36 36
         :password => params[:password],
37 37
         :email    => params[:email],
@@ -40,21 +40,21 @@ describe 'heat::keystone::auth' do
40 40
     end
41 41
 
42 42
     it 'configures heat user roles' do
43
-      should contain_keystone_user_role("#{params[:auth_name]}@#{params[:tenant]}").with(
43
+      is_expected.to contain_keystone_user_role("#{params[:auth_name]}@#{params[:tenant]}").with(
44 44
         :ensure  => 'present',
45 45
         :roles   => ['admin']
46 46
       )
47 47
     end
48 48
 
49 49
     it 'configures heat stack_user role' do
50
-      should contain_keystone_role("heat_stack_user").with(
50
+      is_expected.to contain_keystone_role("heat_stack_user").with(
51 51
         :ensure  => 'present'
52 52
       )
53 53
     end
54 54
 
55 55
 
56 56
     it 'configures heat service' do
57
-      should contain_keystone_service( params[:auth_name] ).with(
57
+      is_expected.to contain_keystone_service( params[:auth_name] ).with(
58 58
         :ensure      => 'present',
59 59
         :type        => params[:service_type],
60 60
         :description => 'Openstack Orchestration Service'
@@ -62,7 +62,7 @@ describe 'heat::keystone::auth' do
62 62
     end
63 63
 
64 64
     it 'configure heat endpoints' do
65
-      should contain_keystone_endpoint("#{params[:region]}/#{params[:auth_name]}").with(
65
+      is_expected.to contain_keystone_endpoint("#{params[:region]}/#{params[:auth_name]}").with(
66 66
         :ensure       => 'present',
67 67
         :public_url   => "#{params[:public_protocol]}://#{params[:public_address]}:#{params[:port]}/#{params[:version]}/%(tenant_id)s",
68 68
         :admin_url    => "#{params[:admin_protocol]}://#{params[:admin_address]}:#{params[:port]}/#{params[:version]}/%(tenant_id)s",
@@ -95,16 +95,16 @@ describe 'heat::keystone::auth' do
95 95
       })
96 96
     end
97 97
     it 'configures correct user name' do
98
-      should contain_keystone_user('heat')
98
+      is_expected.to contain_keystone_user('heat')
99 99
     end
100 100
     it 'configures correct user role' do
101
-      should contain_keystone_user_role('heat@services')
101
+      is_expected.to contain_keystone_user_role('heat@services')
102 102
     end
103 103
     it 'configures correct service name' do
104
-      should contain_keystone_service('heat_service')
104
+      is_expected.to contain_keystone_service('heat_service')
105 105
     end
106 106
     it 'configures correct endpoint name' do
107
-      should contain_keystone_endpoint('RegionOne/heat_service')
107
+      is_expected.to contain_keystone_endpoint('RegionOne/heat_service')
108 108
     end
109 109
   end
110 110
 
@@ -113,10 +113,10 @@ describe 'heat::keystone::auth' do
113 113
       params.merge!( :configure_user => false )
114 114
     end
115 115
 
116
-    it { should_not contain_keystone_user('heat') }
117
-    it { should contain_keystone_user_role('heat@services') }
116
+    it { is_expected.to_not contain_keystone_user('heat') }
117
+    it { is_expected.to contain_keystone_user_role('heat@services') }
118 118
 
119
-    it { should contain_keystone_service('heat').with(
119
+    it { is_expected.to contain_keystone_service('heat').with(
120 120
       :ensure       => 'present',
121 121
       :type         => 'orchestration',
122 122
       :description  => 'Openstack Orchestration Service'
@@ -131,10 +131,10 @@ describe 'heat::keystone::auth' do
131 131
       )
132 132
     end
133 133
 
134
-    it { should_not contain_keystone_user('heat') }
135
-    it { should_not contain_keystone_user_role('heat@services') }
134
+    it { is_expected.to_not contain_keystone_user('heat') }
135
+    it { is_expected.to_not contain_keystone_user_role('heat@services') }
136 136
 
137
-    it { should contain_keystone_service('heat').with(
137
+    it { is_expected.to contain_keystone_service('heat').with(
138 138
       :ensure       => 'present',
139 139
       :type         => 'orchestration',
140 140
       :description  => 'Openstack Orchestration Service'
@@ -160,7 +160,7 @@ describe 'heat::keystone::auth' do
160 160
       })
161 161
     end
162 162
     it 'configures delegated roles' do
163
-      should contain_keystone_role("heat_stack_owner").with(
163
+      is_expected.to contain_keystone_role("heat_stack_owner").with(
164 164
         :ensure  => 'present'
165 165
       )
166 166
     end
@@ -184,10 +184,7 @@ describe 'heat::keystone::auth' do
184 184
         :password                  => 'something',
185 185
       }
186 186
     end
187
-    it 'should fail with deprecated and new params both set' do
188
-        expect {
189
-            should compile
190
-        }.to raise_error Puppet::Error, /both heat::engine and heat::keystone::auth are both trying to configure delegated roles/
191
-    end
187
+    it_raises 'a Puppet::Error', /both heat::engine and heat::keystone::auth are both trying to configure delegated roles/
188
+
192 189
   end
193 190
 end

+ 2
- 2
spec/classes/heat_keystone_domain_spec.rb View File

@@ -21,7 +21,7 @@ describe 'heat::keystone::domain' do
21 21
     end
22 22
 
23 23
     it 'should configure heat domain id' do
24
-      should contain_heat_domain_id_setter('heat_domain_id').with(
24
+      is_expected.to contain_heat_domain_id_setter('heat_domain_id').with(
25 25
         :ensure           => 'present',
26 26
         :domain_name      => params[:domain_name],
27 27
         :auth_url         => params[:auth_url],
@@ -32,7 +32,7 @@ describe 'heat::keystone::domain' do
32 32
     end
33 33
 
34 34
     it 'should exec helper script' do
35
-      should contain_exec('heat_domain_create').with(
35
+      is_expected.to contain_exec('heat_domain_create').with(
36 36
         :command     => 'heat-keystone-setup-domain &>/dev/null',
37 37
         :path        => '/usr/bin',
38 38
         :require     => 'Package[heat-common]',

+ 12
- 12
spec/classes/heat_logging_spec.rb View File

@@ -42,36 +42,36 @@ describe 'heat::logging' do
42 42
 
43 43
   shared_examples_for 'logging params set' do
44 44
     it 'enables logging params' do
45
-      should contain_heat_config('DEFAULT/logging_context_format_string').with_value(
45
+      is_expected.to contain_heat_config('DEFAULT/logging_context_format_string').with_value(
46 46
         '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [%(request_id)s %(user_identity)s] %(instance)s%(message)s')
47 47
 
48
-      should contain_heat_config('DEFAULT/logging_default_format_string').with_value(
48
+      is_expected.to contain_heat_config('DEFAULT/logging_default_format_string').with_value(
49 49
         '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [-] %(instance)s%(message)s')
50 50
 
51
-      should contain_heat_config('DEFAULT/logging_debug_format_suffix').with_value(
51
+      is_expected.to contain_heat_config('DEFAULT/logging_debug_format_suffix').with_value(
52 52
         '%(funcName)s %(pathname)s:%(lineno)d')
53 53
 
54
-      should contain_heat_config('DEFAULT/logging_exception_prefix').with_value(
54
+      is_expected.to contain_heat_config('DEFAULT/logging_exception_prefix').with_value(
55 55
        '%(asctime)s.%(msecs)03d %(process)d TRACE %(name)s %(instance)s')
56 56
 
57
-      should contain_heat_config('DEFAULT/log_config_append').with_value(
57
+      is_expected.to contain_heat_config('DEFAULT/log_config_append').with_value(
58 58
         '/etc/heat/logging.conf')
59
-      should contain_heat_config('DEFAULT/publish_errors').with_value(
59
+      is_expected.to contain_heat_config('DEFAULT/publish_errors').with_value(
60 60
         true)
61 61
 
62
-      should contain_heat_config('DEFAULT/default_log_levels').with_value(
62
+      is_expected.to contain_heat_config('DEFAULT/default_log_levels').with_value(
63 63
         'amqp=WARN,amqplib=WARN,boto=WARN,iso8601=WARN,qpid=WARN,requests.packages.urllib3.connectionpool=WARN,sqlalchemy=WARN,suds=INFO')
64 64
 
65
-      should contain_heat_config('DEFAULT/fatal_deprecations').with_value(
65
+      is_expected.to contain_heat_config('DEFAULT/fatal_deprecations').with_value(
66 66
         true)
67 67
 
68
-      should contain_heat_config('DEFAULT/instance_format').with_value(
68
+      is_expected.to contain_heat_config('DEFAULT/instance_format').with_value(
69 69
         '[instance: %(uuid)s] ')
70 70
 
71
-      should contain_heat_config('DEFAULT/instance_uuid_format').with_value(
71
+      is_expected.to contain_heat_config('DEFAULT/instance_uuid_format').with_value(
72 72
         '[instance: %(uuid)s] ')
73 73
 
74
-      should contain_heat_config('DEFAULT/log_date_format').with_value(
74
+      is_expected.to contain_heat_config('DEFAULT/log_date_format').with_value(
75 75
         '%Y-%m-%d %H:%M:%S')
76 76
     end
77 77
   end
@@ -84,7 +84,7 @@ describe 'heat::logging' do
84 84
      :default_log_levels, :fatal_deprecations,
85 85
      :instance_format, :instance_uuid_format,
86 86
      :log_date_format, ].each { |param|
87
-        it { should contain_heat_config("DEFAULT/#{param}").with_ensure('absent') }
87
+	it { is_expected.to contain_heat_config("DEFAULT/#{param}").with_ensure('absent') }
88 88
       }
89 89
   end
90 90
 

+ 1
- 1
spec/classes/heat_policy_spec.rb View File

@@ -16,7 +16,7 @@ describe 'heat::policy' do
16 16
     end
17 17
 
18 18
     it 'set up the policies' do
19
-      should contain_openstacklib__policy__base('context_is_admin').with({
19
+      is_expected.to contain_openstacklib__policy__base('context_is_admin').with({
20 20
         :key   => 'context_is_admin',
21 21
         :value => 'foo:bar'
22 22
       })

+ 1
- 1
spec/shared_examples.rb View File

@@ -1,5 +1,5 @@
1 1
 shared_examples_for "a Puppet::Error" do |description|
2 2
   it "with message matching #{description.inspect}" do
3
-    expect { should have_class_count(1) }.to raise_error(Puppet::Error, description)
3
+    expect { is_expected.to have_class_count(1) }.to raise_error(Puppet::Error, description)
4 4
   end
5 5
 end

+ 6
- 6
spec/unit/provider/heat_domain_id_setter/heat_spec.rb View File

@@ -75,7 +75,7 @@ describe 'Puppet::Type.type(:heat_keystone_domain_id_setter)' do
75 75
         it 'should create a resource' do
76 76
             resource = Puppet::Type::Heat_domain_id_setter.new(params)
77 77
             provider = provider_class.new(resource)
78
-            expect(provider.exists?).to be_false
78
+	    expect(provider.exists?).to be_falsey
79 79
             expect(provider.create).to be_nil
80 80
         end
81 81
     end
@@ -99,7 +99,7 @@ describe 'Puppet::Type.type(:heat_keystone_domain_id_setter)' do
99 99
         it 'should receive an api error' do
100 100
             resource = Puppet::Type::Heat_domain_id_setter.new(params)
101 101
             provider = provider_class.new(resource)
102
-            expect(provider.exists?).to be_false
102
+	    expect(provider.exists?).to be_falsey
103 103
             expect { provider.create }.to raise_error KeystoneAPIError, /Unable to find matching domain/
104 104
         end
105 105
     end
@@ -124,7 +124,7 @@ describe 'Puppet::Type.type(:heat_keystone_domain_id_setter)' do
124 124
         it 'should receive an api error' do
125 125
             resource = Puppet::Type::Heat_domain_id_setter.new(params)
126 126
             provider = provider_class.new(resource)
127
-            expect(provider.exists?).to be_false
127
+	    expect(provider.exists?).to be_falsey
128 128
             expect { provider.create }.to raise_error KeystoneAPIError, /Found multiple matches for domain name/
129 129
         end
130 130
     end
@@ -141,7 +141,7 @@ describe 'Puppet::Type.type(:heat_keystone_domain_id_setter)' do
141 141
         it 'should receive an authentication error' do
142 142
             resource = Puppet::Type::Heat_domain_id_setter.new(params)
143 143
             provider = provider_class.new(resource)
144
-            expect(provider.exists?).to be_false
144
+	    expect(provider.exists?).to be_falsey
145 145
             expect { provider.create }.to raise_error KeystoneAPIError
146 146
         end
147 147
     end
@@ -155,7 +155,7 @@ describe 'Puppet::Type.type(:heat_keystone_domain_id_setter)' do
155 155
         it 'should receive a connection error' do
156 156
             resource = Puppet::Type::Heat_domain_id_setter.new(params)
157 157
             provider = provider_class.new(resource)
158
-            expect(provider.exists?).to be_false
158
+	    expect(provider.exists?).to be_falsey
159 159
             expect { provider.create }.to raise_error KeystoneConnectionError
160 160
         end
161 161
     end
@@ -169,7 +169,7 @@ describe 'Puppet::Type.type(:heat_keystone_domain_id_setter)' do
169 169
         it 'should receive a connection error' do
170 170
             resource = Puppet::Type::Heat_domain_id_setter.new(params)
171 171
             provider = provider_class.new(resource)
172
-            expect(provider.exists?).to be_false
172
+	    expect(provider.exists?).to be_falsey
173 173
             expect { provider.create }.to raise_error KeystoneConnectionError
174 174
         end
175 175
     end

Loading…
Cancel
Save