diff options
author | Samuel Cassiba <s@cassiba.com> | 2017-11-26 22:32:21 -0800 |
---|---|---|
committer | Samuel Cassiba <s@cassiba.com> | 2017-12-12 17:34:08 -0800 |
commit | c18919e533b02726cde4219c1579ea7e6d66dc90 (patch) | |
tree | cb4e66434d403748d3f7715f3c0eda8365ecacbf /spec | |
parent | 54f8d6d9174540debd0659abc2bbe782379f65f4 (diff) |
block-storage refactor for Pike and Chef 13
- deprecated postgresql support
- dropped apt cookbook dependency
- deprecated node.foo.bar method access for node['foo']['bar'] bracket syntax
- implemented foodcritic and cookstyle corrections
- migrated cinder api to a Chef-managed config
- deprecated cinder-group-active service, as it is no longer needed and gets in
the way of functionality
- added lvm cookbook dependency for better pv/vg handling
Implements blueprint modern-chef
Change-Id: Id248c9267af6750c871487bc8b577aa2011a782a
Notes
Notes (review):
Code-Review+2: Jan Klare <j.klare@cloudbau.de>
Workflow+1: Christoph Albers <c.albers@x-ion.de>
Verified+2: Zuul
Submitted-by: Zuul
Submitted-at: Fri, 22 Dec 2017 11:48:18 +0000
Reviewed-on: https://review.openstack.org/523031
Project: openstack/cookbook-openstack-block-storage
Branch: refs/heads/master
Diffstat (limited to 'spec')
-rw-r--r-- | spec/api-redhat_spec.rb | 7 | ||||
-rw-r--r-- | spec/api_spec.rb | 7 | ||||
-rw-r--r-- | spec/backup-redhat_spec.rb | 7 | ||||
-rw-r--r-- | spec/backup_spec.rb | 7 | ||||
-rw-r--r-- | spec/identity_registration_spec.rb | 32 | ||||
-rw-r--r-- | spec/scheduler-redhat_spec.rb | 7 | ||||
-rw-r--r-- | spec/scheduler_spec.rb | 7 | ||||
-rw-r--r-- | spec/spec_helper.rb | 4 | ||||
-rw-r--r-- | spec/volume-redhat_spec.rb | 9 | ||||
-rw-r--r-- | spec/volume_spec.rb | 11 |
10 files changed, 30 insertions, 68 deletions
diff --git a/spec/api-redhat_spec.rb b/spec/api-redhat_spec.rb index d0ef802..11f73b6 100644 --- a/spec/api-redhat_spec.rb +++ b/spec/api-redhat_spec.rb | |||
@@ -19,12 +19,5 @@ describe 'openstack-block-storage::api' do | |||
19 | it 'upgrades mysql python package' do | 19 | it 'upgrades mysql python package' do |
20 | expect(chef_run).to upgrade_package 'MySQL-python' | 20 | expect(chef_run).to upgrade_package 'MySQL-python' |
21 | end | 21 | end |
22 | |||
23 | it 'upgrades postgresql python packages if explicitly told' do | ||
24 | node.set['openstack']['db']['block-storage']['service_type'] = 'postgresql' | ||
25 | |||
26 | expect(chef_run).to upgrade_package 'python-psycopg2' | ||
27 | expect(chef_run).not_to upgrade_package 'MySQL-python' | ||
28 | end | ||
29 | end | 22 | end |
30 | end | 23 | end |
diff --git a/spec/api_spec.rb b/spec/api_spec.rb index 366a2bb..13f9897 100644 --- a/spec/api_spec.rb +++ b/spec/api_spec.rb | |||
@@ -22,13 +22,6 @@ describe 'openstack-block-storage::api' do | |||
22 | expect(chef_run).to upgrade_package('python-mysqldb') | 22 | expect(chef_run).to upgrade_package('python-mysqldb') |
23 | end | 23 | end |
24 | 24 | ||
25 | it 'upgrades postgresql python packages if explicitly told' do | ||
26 | node.set['openstack']['db']['block-storage']['service_type'] = 'postgresql' | ||
27 | |||
28 | expect(chef_run).to upgrade_package('python-psycopg2') | ||
29 | expect(chef_run).not_to upgrade_package('python-mysqldb') | ||
30 | end | ||
31 | |||
32 | it 'runs db migrations' do | 25 | it 'runs db migrations' do |
33 | expect(chef_run).to run_execute('cinder-manage db sync').with(user: 'cinder', group: 'cinder') | 26 | expect(chef_run).to run_execute('cinder-manage db sync').with(user: 'cinder', group: 'cinder') |
34 | end | 27 | end |
diff --git a/spec/backup-redhat_spec.rb b/spec/backup-redhat_spec.rb index 3e46c41..7fc940b 100644 --- a/spec/backup-redhat_spec.rb +++ b/spec/backup-redhat_spec.rb | |||
@@ -28,13 +28,6 @@ describe 'openstack-block-storage::backup' do | |||
28 | it 'upgrades mysql python package' do | 28 | it 'upgrades mysql python package' do |
29 | expect(chef_run).to upgrade_package 'MySQL-python' | 29 | expect(chef_run).to upgrade_package 'MySQL-python' |
30 | end | 30 | end |
31 | |||
32 | it 'upgrades postgresql python packages if explicitly told' do | ||
33 | node.set['openstack']['db']['block-storage']['service_type'] = 'postgresql' | ||
34 | |||
35 | expect(chef_run).to upgrade_package 'python-psycopg2' | ||
36 | expect(chef_run).not_to upgrade_package 'MySQL-python' | ||
37 | end | ||
38 | end | 31 | end |
39 | end | 32 | end |
40 | end | 33 | end |
diff --git a/spec/backup_spec.rb b/spec/backup_spec.rb index d8ff358..ed44776 100644 --- a/spec/backup_spec.rb +++ b/spec/backup_spec.rb | |||
@@ -32,13 +32,6 @@ describe 'openstack-block-storage::backup' do | |||
32 | it 'upgrades mysql python package' do | 32 | it 'upgrades mysql python package' do |
33 | expect(chef_run).to upgrade_package 'python-mysqldb' | 33 | expect(chef_run).to upgrade_package 'python-mysqldb' |
34 | end | 34 | end |
35 | |||
36 | it 'upgrades postgresql python packages if explicitly told' do | ||
37 | node.set['openstack']['db']['block-storage']['service_type'] = 'postgresql' | ||
38 | |||
39 | expect(chef_run).to upgrade_package 'python-psycopg2' | ||
40 | expect(chef_run).not_to upgrade_package 'python-mysqldb' | ||
41 | end | ||
42 | end | 35 | end |
43 | end | 36 | end |
44 | end | 37 | end |
diff --git a/spec/identity_registration_spec.rb b/spec/identity_registration_spec.rb index 95e2315..c0cdfec 100644 --- a/spec/identity_registration_spec.rb +++ b/spec/identity_registration_spec.rb | |||
@@ -23,6 +23,7 @@ describe 'openstack-block-storage::identity_registration' do | |||
23 | service_type = 'volumev2' | 23 | service_type = 'volumev2' |
24 | service_user = 'cinder' | 24 | service_user = 'cinder' |
25 | url = 'http://127.0.0.1:8776/v2/%(tenant_id)s' | 25 | url = 'http://127.0.0.1:8776/v2/%(tenant_id)s' |
26 | url_v3 = 'http://127.0.0.1:8776/v3/%(tenant_id)s' | ||
26 | region = 'RegionOne' | 27 | region = 'RegionOne' |
27 | project_name = 'service' | 28 | project_name = 'service' |
28 | role_name = 'service' | 29 | role_name = 'service' |
@@ -46,6 +47,15 @@ describe 'openstack-block-storage::identity_registration' do | |||
46 | ) | 47 | ) |
47 | end | 48 | end |
48 | 49 | ||
50 | it 'registers cinderv3 service' do | ||
51 | expect(chef_run).to create_openstack_service( | ||
52 | 'cinderv3' | ||
53 | ).with( | ||
54 | connection_params: connection_params, | ||
55 | type: 'volumev3' | ||
56 | ) | ||
57 | end | ||
58 | |||
49 | context "registers #{service_name} endpoint" do | 59 | context "registers #{service_name} endpoint" do |
50 | %w(admin internal public).each do |interface| | 60 | %w(admin internal public).each do |interface| |
51 | it "#{interface} endpoint with default values" do | 61 | it "#{interface} endpoint with default values" do |
@@ -59,6 +69,18 @@ describe 'openstack-block-storage::identity_registration' do | |||
59 | connection_params: connection_params | 69 | connection_params: connection_params |
60 | ) | 70 | ) |
61 | end | 71 | end |
72 | |||
73 | it "volumev3 #{interface} endpoint with default values" do | ||
74 | expect(chef_run).to create_openstack_endpoint( | ||
75 | 'volumev3' | ||
76 | ).with( | ||
77 | service_name: 'cinderv3', | ||
78 | # interface: interface, | ||
79 | url: url_v3, | ||
80 | region: region, | ||
81 | connection_params: connection_params | ||
82 | ) | ||
83 | end | ||
62 | end | 84 | end |
63 | 85 | ||
64 | it 'with custom region override' do | 86 | it 'with custom region override' do |
@@ -75,16 +97,6 @@ describe 'openstack-block-storage::identity_registration' do | |||
75 | ).with( | 97 | ).with( |
76 | domain_name: domain_name, | 98 | domain_name: domain_name, |
77 | project_name: project_name, | 99 | project_name: project_name, |
78 | password: password, | ||
79 | connection_params: connection_params | ||
80 | ) | ||
81 | end | ||
82 | |||
83 | it do | ||
84 | expect(chef_run).to grant_role_openstack_user( | ||
85 | service_user | ||
86 | ).with( | ||
87 | project_name: project_name, | ||
88 | role_name: role_name, | 100 | role_name: role_name, |
89 | password: password, | 101 | password: password, |
90 | connection_params: connection_params | 102 | connection_params: connection_params |
diff --git a/spec/scheduler-redhat_spec.rb b/spec/scheduler-redhat_spec.rb index edd0c00..0c2ff2f 100644 --- a/spec/scheduler-redhat_spec.rb +++ b/spec/scheduler-redhat_spec.rb | |||
@@ -27,12 +27,5 @@ describe 'openstack-block-storage::scheduler' do | |||
27 | it 'upgrades mysql python package' do | 27 | it 'upgrades mysql python package' do |
28 | expect(chef_run).to upgrade_package 'MySQL-python' | 28 | expect(chef_run).to upgrade_package 'MySQL-python' |
29 | end | 29 | end |
30 | |||
31 | it 'upgrades postgresql python packages if explicitly told' do | ||
32 | node.set['openstack']['db']['block-storage']['service_type'] = 'postgresql' | ||
33 | |||
34 | expect(chef_run).to upgrade_package 'python-psycopg2' | ||
35 | expect(chef_run).not_to upgrade_package 'MySQL-python' | ||
36 | end | ||
37 | end | 30 | end |
38 | end | 31 | end |
diff --git a/spec/scheduler_spec.rb b/spec/scheduler_spec.rb index 3b60a7c..2cefe34 100644 --- a/spec/scheduler_spec.rb +++ b/spec/scheduler_spec.rb | |||
@@ -29,12 +29,5 @@ describe 'openstack-block-storage::scheduler' do | |||
29 | it 'upgrades mysql python package' do | 29 | it 'upgrades mysql python package' do |
30 | expect(chef_run).to upgrade_package 'python-mysqldb' | 30 | expect(chef_run).to upgrade_package 'python-mysqldb' |
31 | end | 31 | end |
32 | |||
33 | it 'upgrades postgresql python packages if explicitly told' do | ||
34 | node.set['openstack']['db']['block-storage']['service_type'] = 'postgresql' | ||
35 | |||
36 | expect(chef_run).to upgrade_package 'python-psycopg2' | ||
37 | expect(chef_run).not_to upgrade_package 'python-mysqldb' | ||
38 | end | ||
39 | end | 32 | end |
40 | end | 33 | end |
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index eb82788..cb91497 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb | |||
@@ -12,7 +12,7 @@ require 'chef/application' | |||
12 | LOG_LEVEL = :fatal | 12 | LOG_LEVEL = :fatal |
13 | REDHAT_OPTS = { | 13 | REDHAT_OPTS = { |
14 | platform: 'redhat', | 14 | platform: 'redhat', |
15 | version: '7.1', | 15 | version: '7.3', |
16 | log_level: LOG_LEVEL, | 16 | log_level: LOG_LEVEL, |
17 | }.freeze | 17 | }.freeze |
18 | UBUNTU_OPTS = { | 18 | UBUNTU_OPTS = { |
@@ -58,6 +58,8 @@ shared_context 'block-storage-stubs' do | |||
58 | allow_any_instance_of(Chef::Recipe).to receive(:rabbit_transport_url) | 58 | allow_any_instance_of(Chef::Recipe).to receive(:rabbit_transport_url) |
59 | .with('block-storage') | 59 | .with('block-storage') |
60 | .and_return('rabbit://guest:mypass@127.0.0.1:5672') | 60 | .and_return('rabbit://guest:mypass@127.0.0.1:5672') |
61 | stub_command('/usr/sbin/httpd -t').and_return(true) | ||
62 | stub_command('/usr/sbin/apache2 -t').and_return(true) | ||
61 | allow(Chef::Application).to receive(:fatal!) | 63 | allow(Chef::Application).to receive(:fatal!) |
62 | end | 64 | end |
63 | end | 65 | end |
diff --git a/spec/volume-redhat_spec.rb b/spec/volume-redhat_spec.rb index 1830442..7e3e1a4 100644 --- a/spec/volume-redhat_spec.rb +++ b/spec/volume-redhat_spec.rb | |||
@@ -16,13 +16,6 @@ describe 'openstack-block-storage::volume' do | |||
16 | expect(chef_run).to upgrade_package('MySQL-python') | 16 | expect(chef_run).to upgrade_package('MySQL-python') |
17 | end | 17 | end |
18 | 18 | ||
19 | it 'upgrades postgresql python packages if explicitly told' do | ||
20 | node.set['openstack']['db']['block-storage']['service_type'] = 'postgresql' | ||
21 | |||
22 | expect(chef_run).to upgrade_package('python-psycopg2') | ||
23 | expect(chef_run).not_to upgrade_package('MySQL-python') | ||
24 | end | ||
25 | |||
26 | it 'upgrades qemu-img-ev package' do | 19 | it 'upgrades qemu-img-ev package' do |
27 | expect(chef_run).to upgrade_package('qemu-img-ev') | 20 | expect(chef_run).to upgrade_package('qemu-img-ev') |
28 | end | 21 | end |
@@ -41,7 +34,7 @@ describe 'openstack-block-storage::volume' do | |||
41 | 34 | ||
42 | context 'ISCSI' do | 35 | context 'ISCSI' do |
43 | it 'starts iscsi target on boot' do | 36 | it 'starts iscsi target on boot' do |
44 | expect(chef_run).to enable_service('target') | 37 | expect(chef_run).to enable_service('iscsitarget') |
45 | end | 38 | end |
46 | end | 39 | end |
47 | end | 40 | end |
diff --git a/spec/volume_spec.rb b/spec/volume_spec.rb index 5c6b3b2..b5efa33 100644 --- a/spec/volume_spec.rb +++ b/spec/volume_spec.rb | |||
@@ -22,6 +22,10 @@ describe 'openstack-block-storage::volume' do | |||
22 | expect(chef_run).to upgrade_package 'qemu-utils' | 22 | expect(chef_run).to upgrade_package 'qemu-utils' |
23 | end | 23 | end |
24 | 24 | ||
25 | it 'upgrades thin provisioning tools package' do | ||
26 | expect(chef_run).to upgrade_package 'thin-provisioning-tools' | ||
27 | end | ||
28 | |||
25 | it 'starts cinder volume' do | 29 | it 'starts cinder volume' do |
26 | expect(chef_run).to start_service 'cinder-volume' | 30 | expect(chef_run).to start_service 'cinder-volume' |
27 | end | 31 | end |
@@ -38,13 +42,6 @@ describe 'openstack-block-storage::volume' do | |||
38 | expect(chef_run).to upgrade_package 'python-mysqldb' | 42 | expect(chef_run).to upgrade_package 'python-mysqldb' |
39 | end | 43 | end |
40 | 44 | ||
41 | it 'upgrades postgresql python packages if explicitly told' do | ||
42 | node.set['openstack']['db']['block-storage']['service_type'] = 'postgresql' | ||
43 | |||
44 | expect(chef_run).to upgrade_package 'python-psycopg2' | ||
45 | expect(chef_run).not_to upgrade_package 'python-mysqldb' | ||
46 | end | ||
47 | |||
48 | it 'upgrades cinder iscsi package' do | 45 | it 'upgrades cinder iscsi package' do |
49 | expect(chef_run).to upgrade_package 'tgt' | 46 | expect(chef_run).to upgrade_package 'tgt' |
50 | end | 47 | end |