summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorMark Vanderwiel <vanderwl@us.ibm.com>2015-05-28 14:37:17 -0500
committerMark Vanderwiel <vanderwl@us.ibm.com>2015-05-28 14:43:16 -0500
commit0b9410309810d412de30cb672d98ed273800d965 (patch)
tree6fc0750c12b68f38b935cee8049a61a5ef164010 /spec
parent6a8e987f424449647e2bdd72909a46c95cc2efb2 (diff)
Cleanup minor rubocop offenses
Cleaned up all the minor rubocop issues, the ones left relate to complex logic and what I think is a bug in rubocop for nested vs compact modules/class definitions. Change-Id: I5ac6d513c3b1397ba7205dc6f661134a93d17741
Notes
Notes (review): Verified+2: Jenkins Code-Review+2: Jan Klare <j.klare@x-ion.de> Workflow+1: JJ Asghar <jj@getchef.com> Submitted-by: Jenkins Submitted-at: Fri, 29 May 2015 16:24:08 +0000 Reviewed-on: https://review.openstack.org/186541 Project: stackforge/cookbook-openstack-block-storage Branch: refs/heads/master
Diffstat (limited to 'spec')
-rw-r--r--spec/api_spec.rb15
-rw-r--r--spec/backup_spec.rb1
-rw-r--r--spec/cinder_common_spec.rb62
-rw-r--r--spec/spec_helper.rb13
-rw-r--r--spec/volume-redhat_spec.rb20
-rw-r--r--spec/volume_spec.rb30
6 files changed, 56 insertions, 85 deletions
diff --git a/spec/api_spec.rb b/spec/api_spec.rb
index 9a25580..5df877c 100644
--- a/spec/api_spec.rb
+++ b/spec/api_spec.rb
@@ -39,16 +39,11 @@ describe 'openstack-block-storage::api' do
39 let(:dir) { chef_run.directory('/var/cache/cinder') } 39 let(:dir) { chef_run.directory('/var/cache/cinder') }
40 40
41 it 'should create the directory' do 41 it 'should create the directory' do
42 expect(chef_run).to create_directory(dir.name) 42 expect(chef_run).to create_directory(dir.name).with(
43 end 43 owner: 'cinder',
44 44 group: 'cinder',
45 it 'has proper owner' do 45 mode: 00700
46 expect(dir.owner).to eq('cinder') 46 )
47 expect(dir.group).to eq('cinder')
48 end
49
50 it 'has proper modes' do
51 expect(sprintf('%o', dir.mode)).to eq('700')
52 end 47 end
53 end 48 end
54 49
diff --git a/spec/backup_spec.rb b/spec/backup_spec.rb
index 0dffd0f..06705a3 100644
--- a/spec/backup_spec.rb
+++ b/spec/backup_spec.rb
@@ -75,6 +75,5 @@ describe 'openstack-block-storage::backup' do
75 expect(chef_run).not_to upgrade_package 'python-mysqldb' 75 expect(chef_run).not_to upgrade_package 'python-mysqldb'
76 end 76 end
77 end 77 end
78
79 end 78 end
80end 79end
diff --git a/spec/cinder_common_spec.rb b/spec/cinder_common_spec.rb
index 6166433..6d7b0df 100644
--- a/spec/cinder_common_spec.rb
+++ b/spec/cinder_common_spec.rb
@@ -25,16 +25,11 @@ describe 'openstack-block-storage::cinder-common' do
25 let(:dir) { chef_run.directory('/etc/cinder') } 25 let(:dir) { chef_run.directory('/etc/cinder') }
26 26
27 it 'should create the /etc/cinder directory' do 27 it 'should create the /etc/cinder directory' do
28 expect(chef_run).to create_directory(dir.name) 28 expect(chef_run).to create_directory(dir.name).with(
29 end 29 owner: 'cinder',
30 30 group: 'cinder',
31 it 'has proper owner' do 31 mode: 00750
32 expect(dir.owner).to eq('cinder') 32 )
33 expect(dir.group).to eq('cinder')
34 end
35
36 it 'has proper modes' do
37 expect(sprintf('%o', dir.mode)).to eq '750'
38 end 33 end
39 end 34 end
40 35
@@ -48,16 +43,11 @@ describe 'openstack-block-storage::cinder-common' do
48 end 43 end
49 44
50 it 'should create the cinder.conf template' do 45 it 'should create the cinder.conf template' do
51 expect(chef_run).to create_template(file.name) 46 expect(chef_run).to create_template(file.name).with(
52 end 47 owner: 'cinder',
53 48 group: 'cinder',
54 it 'has proper owner' do 49 mode: 00640
55 expect(file.owner).to eq('cinder') 50 )
56 expect(file.group).to eq('cinder')
57 end
58
59 it 'has proper modes' do
60 expect(sprintf('%o', file.mode)).to eq '640'
61 end 51 end
62 52
63 context 'keystone authtoken attributes with default values' do 53 context 'keystone authtoken attributes with default values' do
@@ -124,13 +114,12 @@ describe 'openstack-block-storage::cinder-common' do
124 end 114 end
125 115
126 context 'endpoint related' do 116 context 'endpoint related' do
127
128 it 'has auth_uri' do 117 it 'has auth_uri' do
129 expect(chef_run).to render_file(file.name).with_content(%r(^auth_uri = http://127.0.0.1:5000/v2.0$)) 118 expect(chef_run).to render_file(file.name).with_content(%r{^auth_uri = http://127.0.0.1:5000/v2.0$})
130 end 119 end
131 120
132 it 'has identity_uri' do 121 it 'has identity_uri' do
133 expect(chef_run).to render_file(file.name).with_content(%r(^identity_uri = http://127.0.0.1:35357/$)) 122 expect(chef_run).to render_file(file.name).with_content(%r{^identity_uri = http://127.0.0.1:35357/$})
134 end 123 end
135 end 124 end
136 125
@@ -165,7 +154,6 @@ describe 'openstack-block-storage::cinder-common' do
165 end 154 end
166 155
167 context 'template contents' do 156 context 'template contents' do
168
169 context 'commonly named attributes' do 157 context 'commonly named attributes' do
170 %w(debug verbose host notification_driver 158 %w(debug verbose host notification_driver
171 storage_availability_zone quota_volumes quota_gigabytes quota_driver 159 storage_availability_zone quota_volumes quota_gigabytes quota_driver
@@ -237,7 +225,7 @@ describe 'openstack-block-storage::cinder-common' do
237 end 225 end
238 226
239 it 'has a lock_path attribute' do 227 it 'has a lock_path attribute' do
240 expect(chef_run).to render_config_file(file.name).with_section_content('oslo_concurrency', %r(^lock_path=/var/lib/cinder/lock$)) 228 expect(chef_run).to render_config_file(file.name).with_section_content('oslo_concurrency', %r{^lock_path=/var/lib/cinder/lock$})
241 end 229 end
242 230
243 it 'does not have unique host id by default' do 231 it 'does not have unique host id by default' do
@@ -839,7 +827,7 @@ describe 'openstack-block-storage::cinder-common' do
839 827
840 it 'has wsdl_location line with attribute present' do 828 it 'has wsdl_location line with attribute present' do
841 node.set['openstack']['block-storage']['vmware']['vmware_wsdl_location'] = 'http://127.0.0.1/wsdl' 829 node.set['openstack']['block-storage']['vmware']['vmware_wsdl_location'] = 'http://127.0.0.1/wsdl'
842 expect(chef_run).to render_file(file.name).with_content(%r(^vmware_wsdl_location = http://127.0.0.1/wsdl$)) 830 expect(chef_run).to render_file(file.name).with_content(%r{^vmware_wsdl_location = http://127.0.0.1/wsdl$})
843 end 831 end
844 end 832 end
845 833
@@ -1015,7 +1003,6 @@ describe 'openstack-block-storage::cinder-common' do
1015 it 'set gpfs option' do 1003 it 'set gpfs option' do
1016 expect(chef_run).to render_file(file.name).with_content(/^gpfs_mount_point_base = multi-gpfs-mnt$/) 1004 expect(chef_run).to render_file(file.name).with_content(/^gpfs_mount_point_base = multi-gpfs-mnt$/)
1017 end 1005 end
1018
1019 end 1006 end
1020 1007
1021 it 'no multiple backends configured' do 1008 it 'no multiple backends configured' do
@@ -1032,16 +1019,11 @@ describe 'openstack-block-storage::cinder-common' do
1032 let(:dir) { chef_run.directory('/var/lib/cinder/lock') } 1019 let(:dir) { chef_run.directory('/var/lib/cinder/lock') }
1033 1020
1034 it 'should create the /var/lib/cinder/lock directory' do 1021 it 'should create the /var/lib/cinder/lock directory' do
1035 expect(chef_run).to create_directory(dir.name) 1022 expect(chef_run).to create_directory(dir.name).with(
1036 end 1023 user: 'cinder',
1037 1024 group: 'cinder',
1038 it 'has proper owner' do 1025 mode: 00755
1039 expect(dir.owner).to eq('cinder') 1026 )
1040 expect(dir.group).to eq('cinder')
1041 end
1042
1043 it 'has proper modes' do
1044 expect(sprintf('%o', dir.mode)).to eq '755'
1045 end 1027 end
1046 end 1028 end
1047 1029
@@ -1061,13 +1043,13 @@ describe 'openstack-block-storage::cinder-common' do
1061 node.set['openstack']['block-storage']['custom_template_banner'] = 'banner' 1043 node.set['openstack']['block-storage']['custom_template_banner'] = 'banner'
1062 1044
1063 expect(chef_run).to render_file(file.name) 1045 expect(chef_run).to render_file(file.name)
1064 .with_content(/^banner$/) 1046 .with_content(/^banner$/)
1065 end 1047 end
1066 1048
1067 it 'sets the default attributes' do 1049 it 'sets the default attributes' do
1068 [ 1050 [
1069 %r(^filters_path=/etc/cinder/rootwrap.d,/usr/share/cinder/rootwrap$), 1051 %r{^filters_path=/etc/cinder/rootwrap.d,/usr/share/cinder/rootwrap$},
1070 %r(^exec_dirs=/sbin,/usr/sbin,/bin,/usr/bin$), 1052 %r{^exec_dirs=/sbin,/usr/sbin,/bin,/usr/bin$},
1071 /^use_syslog=False$/, 1053 /^use_syslog=False$/,
1072 /^syslog_log_facility=syslog$/, 1054 /^syslog_log_facility=syslog$/,
1073 /^syslog_log_level=ERROR$/ 1055 /^syslog_log_level=ERROR$/
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index e210954..836e780 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -99,13 +99,12 @@ def expect_creates_cinder_conf(service, user, group, action = :restart) # ruboco
99 describe 'cinder.conf' do 99 describe 'cinder.conf' do
100 let(:file) { chef_run.template('/etc/cinder/cinder.conf') } 100 let(:file) { chef_run.template('/etc/cinder/cinder.conf') }
101 101
102 it 'has proper owner' do 102 it 'creates the /etc/cinder/cinder.conf file' do
103 expect(file.owner).to eq(user) 103 expect(chef_run).to create_template(file.name).with(
104 expect(file.group).to eq(group) 104 user: user,
105 end 105 group: group,
106 106 mode: 0640
107 it 'has proper modes' do 107 )
108 expect(sprintf('%o', file.mode)).to eq '640'
109 end 108 end
110 109
111 it 'notifies service restart' do 110 it 'notifies service restart' do
diff --git a/spec/volume-redhat_spec.rb b/spec/volume-redhat_spec.rb
index 8327bc6..c77278a 100644
--- a/spec/volume-redhat_spec.rb
+++ b/spec/volume-redhat_spec.rb
@@ -63,9 +63,9 @@ describe 'openstack-block-storage::volume' do
63 63
64 it 'creates IBMNAS shares_config file' do 64 it 'creates IBMNAS shares_config file' do
65 expect(chef_run).to create_template(file.name).with( 65 expect(chef_run).to create_template(file.name).with(
66 owner: 'cinder', 66 owner: 'cinder',
67 group: 'cinder', 67 group: 'cinder',
68 mode: '0600' 68 mode: '0600'
69 ) 69 )
70 expect(chef_run).to render_file(file.name).with_content('127.0.0.1:/ibm/fs/export') 70 expect(chef_run).to render_file(file.name).with_content('127.0.0.1:/ibm/fs/export')
71 end 71 end
@@ -77,9 +77,9 @@ describe 'openstack-block-storage::volume' do
77 77
78 it 'creates the nfs mount point' do 78 it 'creates the nfs mount point' do
79 expect(chef_run).to create_directory('/mnt/cinder-volumes').with( 79 expect(chef_run).to create_directory('/mnt/cinder-volumes').with(
80 owner: 'cinder', 80 owner: 'cinder',
81 group: 'cinder', 81 group: 'cinder',
82 mode: '0755' 82 mode: '0755'
83 ) 83 )
84 end 84 end
85 end 85 end
@@ -155,9 +155,9 @@ describe 'openstack-block-storage::volume' do
155 155
156 it 'verifies gpfs volume directory is created with owner and mode set correctly' do 156 it 'verifies gpfs volume directory is created with owner and mode set correctly' do
157 expect(@chef_run).to create_directory('volumes').with( 157 expect(@chef_run).to create_directory('volumes').with(
158 owner: 'cinder', 158 owner: 'cinder',
159 group: 'cinder', 159 group: 'cinder',
160 mode: '0755' 160 mode: '0755'
161 ) 161 )
162 end 162 end
163 end 163 end
@@ -172,7 +172,7 @@ describe 'openstack-block-storage::volume' do
172 172
173 describe 'template contents' do 173 describe 'template contents' do
174 it 'sources /etc/rc.d/init.d/functions' do 174 it 'sources /etc/rc.d/init.d/functions' do
175 expect(chef_run).to render_file(file.name).with_content(%r(^\s*. /etc/rc.d/init.d/functions$)) 175 expect(chef_run).to render_file(file.name).with_content(%r{^\s*. /etc/rc.d/init.d/functions$})
176 end 176 end
177 177
178 it 'calls success and echo' do 178 it 'calls success and echo' do
diff --git a/spec/volume_spec.rb b/spec/volume_spec.rb
index 2b38edf..757fd74 100644
--- a/spec/volume_spec.rb
+++ b/spec/volume_spec.rb
@@ -65,9 +65,9 @@ describe 'openstack-block-storage::volume' do
65 context 'IBMNAS shares_config file' do 65 context 'IBMNAS shares_config file' do
66 it 'creates the file' do 66 it 'creates the file' do
67 expect(chef_run).to create_template(file.name).with( 67 expect(chef_run).to create_template(file.name).with(
68 owner: 'cinder', 68 owner: 'cinder',
69 group: 'cinder', 69 group: 'cinder',
70 mode: '0600' 70 mode: '0600'
71 ) 71 )
72 end 72 end
73 73
@@ -84,9 +84,9 @@ describe 'openstack-block-storage::volume' do
84 84
85 it 'creates the nfs mount point' do 85 it 'creates the nfs mount point' do
86 expect(chef_run).to create_directory('/mnt/cinder-volumes').with( 86 expect(chef_run).to create_directory('/mnt/cinder-volumes').with(
87 owner: 'cinder', 87 owner: 'cinder',
88 group: 'cinder', 88 group: 'cinder',
89 mode: '0755' 89 mode: '0755'
90 ) 90 )
91 end 91 end
92 end 92 end
@@ -216,11 +216,9 @@ describe 'openstack-block-storage::volume' do
216 let(:file) { chef_run.template('/etc/tgt/targets.conf') } 216 let(:file) { chef_run.template('/etc/tgt/targets.conf') }
217 217
218 it 'should create the targets.conf' do 218 it 'should create the targets.conf' do
219 expect(chef_run).to create_template(file.name) 219 expect(chef_run).to create_template(file.name).with(
220 end 220 mode: 0600
221 221 )
222 it 'has proper modes' do
223 expect(sprintf('%o', file.mode)).to eq '600'
224 end 222 end
225 223
226 it 'notifies iscsi restart' do 224 it 'notifies iscsi restart' do
@@ -277,7 +275,7 @@ describe 'openstack-block-storage::volume' do
277 end 275 end
278 276
279 it 'calls vgs with the volume name attribute' do 277 it 'calls vgs with the volume name attribute' do
280 expect(chef_run).to render_file(file.name).with_content(%r(vgs #{volume_group_value} > /dev/null 2>&1)) 278 expect(chef_run).to render_file(file.name).with_content(%r{vgs #{volume_group_value} > /dev/null 2>&1})
281 end 279 end
282 280
283 it 'calls vgcreate with the volume name and volume file attributes' do 281 it 'calls vgcreate with the volume name and volume file attributes' do
@@ -315,11 +313,9 @@ describe 'openstack-block-storage::volume' do
315 end 313 end
316 314
317 it 'creates cinder emc config file' do 315 it 'creates cinder emc config file' do
318 expect(chef_run).to create_template(file.name) 316 expect(chef_run).to create_template(file.name).with(
319 end 317 mode: 0644
320 318 )
321 it 'has proper modes' do
322 expect(sprintf('%o', file.mode)).to eq('644')
323 end 319 end
324 320
325 describe 'template contents' do 321 describe 'template contents' do