From 9cf9a0adfa95d9b1a2852e59fb47eb7e583cd888 Mon Sep 17 00:00:00 2001 From: Chen Zhiwei Date: Wed, 11 Dec 2013 08:03:49 -0500 Subject: [PATCH] Upgrade to Havana release Also upgrade gems: - berkshelf, ~> 2.0.10 - chefspec, ~> 3.0.2 - foodcritic, ~> 3.0.3 And update the DEPRECATION keywords Change-Id: I8f8bf961ec065944696d4c85120aefe6c2bf76bb --- Berksfile.lock | 53 ++++----- CHANGELOG.md | 6 +- Gemfile | 6 +- Gemfile.lock | 166 +++++++++++++--------------- README.md | 1 + metadata.rb | 8 +- spec/api-opensuse_spec.rb | 6 +- spec/api-redhat_spec.rb | 6 +- spec/api_spec.rb | 57 ++++------ spec/cinder_common-opensuse_spec.rb | 2 +- spec/cinder_common-redhat_spec.rb | 2 +- spec/cinder_common_spec.rb | 102 +++++++---------- spec/identity_registration_spec.rb | 22 ++-- spec/scheduler-opensuse_spec.rb | 8 +- spec/scheduler-redhat_spec.rb | 8 +- spec/scheduler_spec.rb | 14 +-- spec/spec_helper.rb | 11 +- spec/support/matcher.rb | 3 + spec/volume-opensuse_spec.rb | 16 ++- spec/volume-redhat_spec.rb | 16 ++- spec/volume_spec.rb | 26 ++--- 21 files changed, 242 insertions(+), 297 deletions(-) create mode 100644 spec/support/matcher.rb diff --git a/Berksfile.lock b/Berksfile.lock index 0c5fa9e..d922561 100644 --- a/Berksfile.lock +++ b/Berksfile.lock @@ -1,66 +1,55 @@ { - "sha": "ba71763fac936d414bd4a63f004357f86f6e1bfb", "sources": { "openstack-block-storage": { "path": "." }, "openstack-image": { - "locked_version": "7.0.0", + "locked_version": "8.0.0", "git": "git://github.com/stackforge/cookbook-openstack-image.git", - "ref": "c4af085fd62b542fee13d3a8a4ffdc1885ce37ed" + "ref": "900c9eef120e22368bb27062473ae549643e9594" }, "openstack-identity": { - "locked_version": "7.0.0", + "locked_version": "8.0.0", "git": "git://github.com/stackforge/cookbook-openstack-identity.git", - "ref": "029fe8a648939f832f844562d0e18af2a951c783" + "ref": "3b001b7e07758e2c81b5ae4d1bff8e4a1472b24a" }, "openstack-common": { - "locked_version": "0.3.0", + "locked_version": "8.0.0", "git": "git://github.com/stackforge/cookbook-openstack-common.git", - "ref": "25b183f2362fa501cfee4db331491b3d984a5c05" + "ref": "d5f852daf5d0f3001ddbf1688c43a4bb21e8ca00" }, "apt": { - "locked_version": "2.0.0" - }, - "rabbitmq": { - "locked_version": "2.1.2" - }, - "erlang": { - "locked_version": "1.3.0", - "constraint": ">= 0.9.0" - }, - "yum": { - "locked_version": "2.3.0", - "constraint": ">= 0.5.0" - }, - "build-essential": { - "locked_version": "1.4.0" + "locked_version": "2.3.0" }, "selinux": { - "locked_version": "0.5.6" + "locked_version": "0.6.2" + }, + "python": { + "locked_version": "1.4.4" + }, + "build-essential": { + "locked_version": "1.4.2" + }, + "yum": { + "locked_version": "2.4.4" }, "database": { "locked_version": "1.4.0" }, "mysql": { - "locked_version": "3.0.2", - "constraint": ">= 1.3.0" + "locked_version": "3.0.0" }, "openssl": { - "locked_version": "1.0.2" + "locked_version": "1.1.0" }, "postgresql": { - "locked_version": "3.0.2", - "constraint": ">= 1.0.0" + "locked_version": "3.3.4" }, "aws": { - "locked_version": "0.101.2" + "locked_version": "1.0.0" }, "xfs": { "locked_version": "1.1.0" - }, - "python": { - "locked_version": "1.3.4" } } } diff --git a/CHANGELOG.md b/CHANGELOG.md index db618d5..3b46c00 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,11 @@ openstack-block-storage Cookbook CHANGELOG ============================== This file is used to list changes made in each version of the openstack-block-storage cookbook. -7.2.2 +## 8.0.0 +### New version +* Upgrade to upstream Havana release + +## 7.2.2 ### Bug * fix a bug related to qpid. diff --git a/Gemfile b/Gemfile index 8702618..3491dfb 100644 --- a/Gemfile +++ b/Gemfile @@ -2,8 +2,8 @@ source "https://rubygems.org" gem "chef", "~> 11.4.4" gem "json", "<= 1.7.7" # chef 11 dependency -gem "berkshelf", "~> 2.0.3" -gem "chefspec", "~> 2.0.0" -gem "foodcritic" +gem "berkshelf", "~> 2.0.10" +gem "chefspec", "~> 3.0.2" +gem "foodcritic", "~> 3.0.3" gem "strainer" gem "tailor" diff --git a/Gemfile.lock b/Gemfile.lock index 4cc50ab..6afd4ee 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,26 +1,35 @@ GEM remote: https://rubygems.org/ specs: - activesupport (3.2.13) - i18n (= 0.6.1) + activesupport (3.2.16) + i18n (~> 0.6, >= 0.6.4) multi_json (~> 1.0) - addressable (2.3.4) + addressable (2.3.5) akami (1.2.0) gyoku (>= 0.4.0) nokogiri (>= 1.4.0) - berkshelf (2.0.3) - activesupport (>= 3.2.0) + berkshelf (2.0.10) + activesupport (~> 3.2.0) addressable (~> 2.3.4) - celluloid (>= 0.14.0) + buff-shell_out (~> 0.1) chozo (>= 0.6.1) faraday (>= 0.8.5) hashie (>= 2.0.2) minitar (~> 0.5.4) + rbzip2 (~> 0.2.0) retryable (~> 1.3.3) - ridley (~> 1.0.2) - solve (>= 0.4.4) - test-kitchen (>= 1.0.0.alpha7) + ridley (~> 1.5.0) + solve (>= 0.5.0) thor (~> 0.18.0) + buff-config (0.4.0) + buff-extensions (~> 0.3) + varia_model (~> 0.1) + buff-extensions (0.5.0) + buff-ignore (1.1.1) + buff-platform (0.1.0) + buff-ruby_engine (0.1.0) + buff-shell_out (0.1.1) + buff-ruby_engine (~> 0.1.0) builder (3.2.2) celluloid (0.14.1) timers (>= 1.0.0) @@ -41,127 +50,112 @@ GEM ohai (>= 0.6.0) rest-client (>= 1.0.4, < 1.7.0) yajl-ruby (~> 1.1) - chefspec (1.3.1) - chef (>= 10.0) - erubis - fauxhai (>= 0.1.1, < 2.0) - minitest-chef-handler (>= 0.6.0) - rspec (~> 2.0) + chefspec (3.0.2) + chef (~> 11.0) + fauxhai (~> 2.0) + rspec (~> 2.14) chozo (0.6.1) activesupport (>= 3.2.0) hashie (>= 2.0.2) multi_json (>= 1.3.0) - ci_reporter (1.8.4) - builder (>= 2.1.2) - coderay (1.0.9) - diff-lcs (1.2.4) + diff-lcs (1.2.5) erubis (2.7.0) - faraday (0.8.7) - multipart-post (~> 1.1) - fauxhai (1.1.1) - httparty + faraday (0.8.8) + multipart-post (~> 1.2.0) + fauxhai (2.0.1) net-ssh ohai - ffi (1.9.0) - foodcritic (2.1.0) + ffi (1.9.3) + foodcritic (3.0.3) erubis gherkin (~> 2.11.7) nokogiri (~> 1.5.4) - rak (~> 1.4) + rake treetop (~> 1.4.10) yajl-ruby (~> 1.1.0) gherkin (2.11.8) multi_json (~> 1.3) gssapi (1.0.3) ffi (>= 1.0.1) - gyoku (1.0.0) + gyoku (1.1.0) builder (>= 2.1.2) hashie (2.0.5) - highline (1.6.19) - httparty (0.11.0) - multi_json (~> 1.0) - multi_xml (>= 0.5.2) - httpclient (2.2.0.2) + highline (1.6.20) + httpclient (2.3.4.1) httpi (0.9.7) rack - i18n (0.6.1) + i18n (0.6.9) ipaddress (0.8.0) json (1.7.7) little-plugger (1.1.3) log_switch (0.4.0) - logging (1.6.2) + logging (1.8.1) little-plugger (>= 1.1.3) - method_source (0.8.1) - mime-types (1.23) + multi_json (>= 1.3.6) + mime-types (2.0) minitar (0.5.4) - minitest (4.7.4) - minitest-chef-handler (1.0.1) - chef - ci_reporter - minitest (~> 4.7.3) mixlib-authentication (1.3.0) mixlib-log mixlib-cli (1.3.0) - mixlib-config (1.1.2) + mixlib-config (2.1.0) mixlib-log (1.6.0) - mixlib-shellout (1.1.0) - multi_json (1.7.6) - multi_xml (0.5.4) + mixlib-shellout (1.3.0) + multi_json (1.8.2) multipart-post (1.2.0) - net-http-persistent (2.8) - net-scp (1.1.1) - net-ssh (>= 2.6.5) - net-ssh (2.6.7) + net-http-persistent (2.9) + net-ssh (2.7.0) net-ssh-gateway (1.2.0) net-ssh (>= 2.6.5) net-ssh-multi (1.1) net-ssh (>= 2.1.4) net-ssh-gateway (>= 0.99.0) - nio4r (0.4.6) + nio4r (0.5.0) nokogiri (1.5.10) nori (1.1.5) - ohai (6.16.0) + ohai (6.20.0) ipaddress mixlib-cli mixlib-config mixlib-log mixlib-shellout - systemu + systemu (~> 2.5.2) yajl-ruby polyglot (0.3.3) - pry (0.9.12.2) - coderay (~> 1.0.5) - method_source (~> 0.8) - slop (~> 3.4) rack (1.5.2) - rak (1.4) + rake (10.1.0) + rbzip2 (0.2.0) rest-client (1.6.7) mime-types (>= 1.16) retryable (1.3.3) - ridley (1.0.2) + ridley (1.5.3) addressable + buff-config (~> 0.2) + buff-extensions (~> 0.3) + buff-ignore (~> 1.1) + buff-shell_out (~> 0.1) celluloid (~> 0.14.0) celluloid-io (~> 0.14.0) - chozo (>= 0.6.0) erubis faraday (>= 0.8.4) hashie (>= 2.0.2) + json (>= 1.7.7) mixlib-authentication (>= 1.3.0) net-http-persistent (>= 2.8) net-ssh + nio4r (>= 0.5.0) retryable solve (>= 0.4.4) + varia_model (~> 0.1) winrm (~> 1.1.0) - rspec (2.13.0) - rspec-core (~> 2.13.0) - rspec-expectations (~> 2.13.0) - rspec-mocks (~> 2.13.0) - rspec-core (2.13.1) - rspec-expectations (2.13.0) + rspec (2.14.1) + rspec-core (~> 2.14.0) + rspec-expectations (~> 2.14.0) + rspec-mocks (~> 2.14.0) + rspec-core (2.14.7) + rspec-expectations (2.14.4) diff-lcs (>= 1.1.3, < 2.0) - rspec-mocks (2.13.1) + rspec-mocks (2.14.4) rubyntlm (0.1.1) - safe_yaml (0.9.3) savon (0.9.5) akami (~> 1.0) builder (>= 2.1.2) @@ -170,41 +164,35 @@ GEM nokogiri (>= 1.4.0) nori (~> 1.0) wasabi (~> 1.0) - slop (3.4.5) - solve (0.4.4) - json - strainer (3.0.1) + solve (0.8.2) + strainer (3.3.0) berkshelf (~> 2.0) + buff-platform (~> 0.1) systemu (2.5.2) - tailor (1.2.1) + tailor (1.3.1) log_switch (>= 0.3.0) term-ansicolor (>= 1.0.5) text-table (>= 1.2.2) term-ansicolor (1.2.2) tins (~> 0.8) - test-kitchen (1.0.0.alpha.7) - celluloid - mixlib-shellout - net-scp - net-ssh - pry - safe_yaml - thor text-table (1.2.3) thor (0.18.1) timers (1.1.0) - tins (0.8.0) - treetop (1.4.14) + tins (0.13.1) + treetop (1.4.15) polyglot polyglot (>= 0.3.1) uuidtools (2.1.4) + varia_model (0.2.0) + buff-extensions (~> 0.2) + hashie (>= 2.0.2) wasabi (1.0.0) nokogiri (>= 1.4.0) - winrm (1.1.2) + winrm (1.1.3) gssapi (~> 1.0.0) - httpclient (~> 2.2.0.2) - logging (~> 1.6.1) - nokogiri (~> 1.5.0) + httpclient (~> 2.2, >= 2.2.0.2) + logging (~> 1.6, >= 1.6.1) + nokogiri (~> 1.5) rubyntlm (~> 0.1.1) savon (= 0.9.5) uuidtools (~> 2.1.2) @@ -214,10 +202,10 @@ PLATFORMS ruby DEPENDENCIES - berkshelf (~> 2.0.3) + berkshelf (~> 2.0.10) chef (~> 11.4.4) - chefspec (~> 1.3.0) - foodcritic + chefspec (~> 3.0.2) + foodcritic (~> 3.0.3) json (<= 1.7.7) strainer tailor diff --git a/README.md b/README.md index b201ded..8ac2d5f 100644 --- a/README.md +++ b/README.md @@ -137,6 +137,7 @@ License and Author | **Author** | Ionut Artarisi () | | **Author** | David Geng () | | **Author** | Salman Baset () | +| **Author** | Chen Zhiwei (zhiwchen@cn.ibm.com>) | | | | | **Copyright** | Copyright (c) 2012, Rackspace US, Inc. | | **Copyright** | Copyright (c) 2012-2013, AT&T Services, Inc. | diff --git a/metadata.rb b/metadata.rb index 7225def..ddfaa46 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ maintainer_email "cookbooks@lists.tfoundry.com" license "Apache 2.0" description "The OpenStack Advanced Volume Management service Cinder." long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version "7.2.2" +version "8.0.0" recipe "openstack-block-storage::common", "Defines the common pieces of repeated code from the other recipes" recipe "openstack-block-storage::api", "Installs the cinder-api, sets up the cinder database, and cinder service/user/endpoints in keystone" @@ -17,8 +17,8 @@ recipe "openstack-block-storage::volume", "Installs the cinder-volume end depends "apt" -depends "openstack-common", "~> 0.4.0" -depends "openstack-identity", "~> 7.0" -depends "openstack-image", "~> 7.0" +depends "openstack-common", "~> 8.0" +depends "openstack-identity", "~> 8.0" +depends "openstack-image", "~> 8.0" depends "selinux" depends "python" diff --git a/spec/api-opensuse_spec.rb b/spec/api-opensuse_spec.rb index bcba515..ac3f8cd 100644 --- a/spec/api-opensuse_spec.rb +++ b/spec/api-opensuse_spec.rb @@ -4,7 +4,7 @@ describe "openstack-block-storage::api" do before { block_storage_stubs } describe "opensuse" do before do - @chef_run = ::ChefSpec::ChefRunner.new ::OPENSUSE_OPTS + @chef_run = ::ChefSpec::Runner.new ::OPENSUSE_OPTS @chef_run.converge "openstack-block-storage::api" end @@ -17,7 +17,7 @@ describe "openstack-block-storage::api" do end it "installs postgresql python packages if explicitly told" do - chef_run = ::ChefSpec::ChefRunner.new ::OPENSUSE_OPTS + chef_run = ::ChefSpec::Runner.new ::OPENSUSE_OPTS node = chef_run.node node.set["openstack"]["db"]["volume"]["db_type"] = "postgresql" chef_run.converge "openstack-block-storage::api" @@ -27,7 +27,7 @@ describe "openstack-block-storage::api" do end it "starts cinder api on boot" do - expect(@chef_run).to set_service_to_start_on_boot "openstack-cinder-api" + expect(@chef_run).to enable_service "openstack-cinder-api" end expect_creates_policy_json( diff --git a/spec/api-redhat_spec.rb b/spec/api-redhat_spec.rb index 1e38cbc..1b7bbcc 100644 --- a/spec/api-redhat_spec.rb +++ b/spec/api-redhat_spec.rb @@ -4,7 +4,7 @@ describe "openstack-block-storage::api" do before { block_storage_stubs } describe "redhat" do before do - @chef_run = ::ChefSpec::ChefRunner.new ::REDHAT_OPTS + @chef_run = ::ChefSpec::Runner.new ::REDHAT_OPTS @chef_run.converge "openstack-block-storage::api" end @@ -17,7 +17,7 @@ describe "openstack-block-storage::api" do end it "installs postgresql python packages if explicitly told" do - chef_run = ::ChefSpec::ChefRunner.new ::REDHAT_OPTS + chef_run = ::ChefSpec::Runner.new ::REDHAT_OPTS node = chef_run.node node.set["openstack"]["db"]["volume"]["db_type"] = "postgresql" chef_run.converge "openstack-block-storage::api" @@ -27,7 +27,7 @@ describe "openstack-block-storage::api" do end it "starts cinder api on boot" do - expect(@chef_run).to set_service_to_start_on_boot "openstack-cinder-api" + expect(@chef_run).to enable_service "openstack-cinder-api" end end end diff --git a/spec/api_spec.rb b/spec/api_spec.rb index e8ef258..c8f6d1b 100644 --- a/spec/api_spec.rb +++ b/spec/api_spec.rb @@ -4,7 +4,7 @@ describe "openstack-block-storage::api" do before { block_storage_stubs } describe "ubuntu" do before do - @chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS do |n| + @chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS do |n| n.set["openstack"]["block-storage"]["syslog"]["use"] = true end @chef_run.converge "openstack-block-storage::api" @@ -13,7 +13,7 @@ describe "openstack-block-storage::api" do expect_runs_openstack_common_logging_recipe it "doesn't run logging recipe" do - chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS + chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS chef_run.converge "openstack-block-storage::api" expect(chef_run).not_to include_recipe "openstack-common::logging" @@ -29,7 +29,7 @@ describe "openstack-block-storage::api" do end it "installs postgresql python packages if explicitly told" do - chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS + chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS node = chef_run.node node.set["openstack"]["db"]["volume"]["db_type"] = "postgresql" chef_run.converge "openstack-block-storage::api" @@ -44,7 +44,8 @@ describe "openstack-block-storage::api" do end it "has proper owner" do - expect(@dir).to be_owned_by "cinder", "cinder" + expect(@dir.owner).to eq("cinder") + expect(@dir.group).to eq("cinder") end it "has proper modes" do @@ -53,7 +54,7 @@ describe "openstack-block-storage::api" do end it "starts cinder api on boot" do - expect(@chef_run).to set_service_to_start_on_boot "cinder-api" + expect(@chef_run).to enable_service "cinder-api" end expect_creates_cinder_conf "service[cinder-api]", "cinder", "cinder" @@ -64,51 +65,45 @@ describe "openstack-block-storage::api" do end it "runs logging recipe if node attributes say to" do - expect(@chef_run).to create_file_with_content @file, - "log_config = /etc/openstack/logging.conf" + expect(@chef_run).to render_file(@file).with_content("log_config = /etc/openstack/logging.conf") end it "doesn't run logging recipe" do - chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS + chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS chef_run.converge "openstack-block-storage::api" - expect(chef_run).not_to create_file_with_content @file, - "log_config = /etc/openstack/logging.conf" + expect(chef_run).not_to render_file(@file).with_content("log_config = /etc/openstack/logging.conf") end it "has rbd driver settings" do - chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS do |n| + chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS do |n| n.set["openstack"]["block-storage"]["volume"] = { "driver" => "cinder.volume.drivers.RBDDriver" } end chef_run.converge "openstack-block-storage::api" - expect(chef_run).to create_file_with_content @file, - /^rbd_/ - expect(chef_run).not_to create_file_with_content @file, - /^netapp_/ + expect(chef_run).to render_file(@file).with_content(/^rbd_/) + expect(chef_run).not_to render_file(@file).with_content(/^netapp_/) end it "has netapp driver settings" do - chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS do |n| + chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS do |n| n.set["openstack"]["block-storage"]["volume"] = { "driver" => "cinder.volume.drivers.netapp.NetAppISCSIDriver" } end chef_run.converge "openstack-block-storage::api" - expect(chef_run).to create_file_with_content @file, - /^netapp_/ - expect(chef_run).not_to create_file_with_content @file, - /^rbd_/ + expect(chef_run).to render_file(@file).with_content(/^netapp_/) + expect(chef_run).not_to render_file(@file).with_content(/^rbd_/) end end it "runs db migrations" do cmd = "cinder-manage db sync" - expect(@chef_run).to execute_command cmd + expect(@chef_run).to run_execute(cmd) end expect_creates_policy_json "service[cinder-api]", "cinder", "cinder" @@ -119,7 +114,8 @@ describe "openstack-block-storage::api" do end it "has proper owner" do - expect(@file).to be_owned_by "cinder", "cinder" + expect(@file.owner).to eq("cinder") + expect(@file.group).to eq("cinder") end it "has proper modes" do @@ -127,32 +123,27 @@ describe "openstack-block-storage::api" do end it "has signing_dir" do - expect(@chef_run).to create_file_with_content @file.name, - "signing_dir = /var/cache/cinder/api" + expect(@chef_run).to render_file(@file.name).with_content("signing_dir = /var/cache/cinder/api") end it "notifies cinder-api restart" do - expect(@file).to notify "service[cinder-api]", :restart + expect(@file).to notify("service[cinder-api]").to(:restart) end it "has auth_uri" do - expect(@chef_run).to create_file_with_content @file.name, - "auth_uri = https://127.0.0.1:5000/v2.0" + expect(@chef_run).to render_file(@file.name).with_content("auth_uri = http://127.0.0.1:5000/v2.0") end it "has auth_host" do - expect(@chef_run).to create_file_with_content @file.name, - "auth_host = 127.0.0.1" + expect(@chef_run).to render_file(@file.name).with_content("auth_host = 127.0.0.1") end it "has auth_port" do - expect(@chef_run).to create_file_with_content @file.name, - "auth_port = 35357" + expect(@chef_run).to render_file(@file.name).with_content("auth_port = 35357") end it "has auth_protocol" do - expect(@chef_run).to create_file_with_content @file.name, - "auth_protocol = http" + expect(@chef_run).to render_file(@file.name).with_content("auth_protocol = http") end end end diff --git a/spec/cinder_common-opensuse_spec.rb b/spec/cinder_common-opensuse_spec.rb index dcbca9c..f3d2062 100644 --- a/spec/cinder_common-opensuse_spec.rb +++ b/spec/cinder_common-opensuse_spec.rb @@ -3,7 +3,7 @@ require_relative "spec_helper" describe "openstack-block-storage::cinder-common" do before { block_storage_stubs } before do - @chef_run = ::ChefSpec::ChefRunner.new ::OPENSUSE_OPTS do |n| + @chef_run = ::ChefSpec::Runner.new ::OPENSUSE_OPTS do |n| n.set["openstack"]["mq"] = { "host" => "127.0.0.1" } diff --git a/spec/cinder_common-redhat_spec.rb b/spec/cinder_common-redhat_spec.rb index ad6ce9d..587c201 100644 --- a/spec/cinder_common-redhat_spec.rb +++ b/spec/cinder_common-redhat_spec.rb @@ -3,7 +3,7 @@ require_relative "spec_helper" describe "openstack-block-storage::cinder-common" do before { block_storage_stubs } before do - @chef_run = ::ChefSpec::ChefRunner.new ::REDHAT_OPTS do |n| + @chef_run = ::ChefSpec::Runner.new ::REDHAT_OPTS do |n| n.set["openstack"]["mq"] = { "host" => "127.0.0.1" } diff --git a/spec/cinder_common_spec.rb b/spec/cinder_common_spec.rb index 157c04a..07c520a 100644 --- a/spec/cinder_common_spec.rb +++ b/spec/cinder_common_spec.rb @@ -3,7 +3,7 @@ require_relative "spec_helper" describe "openstack-block-storage::cinder-common" do before { block_storage_stubs } before do - @chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS do |n| + @chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS do |n| n.set["openstack"]["mq"] = { "host" => "127.0.0.1" } @@ -22,7 +22,8 @@ describe "openstack-block-storage::cinder-common" do end it "has proper owner" do - expect(@dir).to be_owned_by "cinder", "cinder" + expect(@dir.owner).to eq("cinder") + expect(@dir.group).to eq("cinder") end it "has proper modes" do @@ -36,7 +37,8 @@ describe "openstack-block-storage::cinder-common" do end it "has proper owner" do - expect(@file).to be_owned_by "cinder", "cinder" + expect(@file.owner).to eq("cinder") + expect(@file.group).to eq("cinder") end it "has proper modes" do @@ -44,96 +46,80 @@ describe "openstack-block-storage::cinder-common" do end it "has rpc_thread_pool_size" do - expect(@chef_run).to create_file_with_content @file.name, - "rpc_thread_pool_size=64" + expect(@chef_run).to render_file(@file.name).with_content("rpc_thread_pool_size=64") end it "has rpc_conn_pool_size" do - expect(@chef_run).to create_file_with_content @file.name, - "rpc_conn_pool_size=30" + expect(@chef_run).to render_file(@file.name).with_content("rpc_conn_pool_size=30") end it "has rpc_response_timeout" do - expect(@chef_run).to create_file_with_content @file.name, - "rpc_response_timeout=60" + expect(@chef_run).to render_file(@file.name).with_content("rpc_response_timeout=60") end it "has rabbit_host" do - expect(@chef_run).to create_file_with_content @file.name, - "rabbit_host=127.0.0.1" + expect(@chef_run).to render_file(@file.name).with_content("rabbit_host=127.0.0.1") end it "does not have rabbit_hosts" do - expect(@chef_run).not_to create_file_with_content @file.name, - "rabbit_hosts=" + expect(@chef_run).not_to render_file(@file.name).with_content("rabbit_hosts=") end it "does not have rabbit_ha_queues" do - expect(@chef_run).not_to create_file_with_content @file.name, - "rabbit_ha_queues=" + expect(@chef_run).not_to render_file(@file.name).with_content("rabbit_ha_queues=") end it "has log_file" do - expect(@chef_run).to create_file_with_content @file.name, - "log_file = /var/log/cinder/cinder.log" + expect(@chef_run).to render_file(@file.name).with_content("log_file = /var/log/cinder/cinder.log") end it "has log_config when syslog is true" do - chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS do |n| + chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS do |n| n.set["openstack"]["block-storage"]["syslog"]["use"] = true end chef_run.converge "openstack-block-storage::cinder-common" - expect(chef_run).to create_file_with_content @file.name, - "log_config = /etc/openstack/logging.conf" + expect(chef_run).to render_file(@file.name).with_content("log_config = /etc/openstack/logging.conf") end it "has rabbit_port" do - expect(@chef_run).to create_file_with_content @file.name, - "rabbit_port=5672" + expect(@chef_run).to render_file(@file.name).with_content("rabbit_port=5672") end it "has rabbit_userid" do - expect(@chef_run).to create_file_with_content @file.name, - "rabbit_userid=guest" + expect(@chef_run).to render_file(@file.name).with_content("rabbit_userid=guest") end it "has rabbit_password" do - expect(@chef_run).to create_file_with_content @file.name, - "rabbit_password=rabbit-pass" + expect(@chef_run).to render_file(@file.name).with_content("rabbit_password=rabbit-pass") end it "has rabbit_virtual_host" do - expect(@chef_run).to create_file_with_content @file.name, - "rabbit_virtual_host=/" + expect(@chef_run).to render_file(@file.name).with_content("rabbit_virtual_host=/") end describe "rabbit ha" do before do - @chef_run = ::ChefSpec::ChefRunner.new(::UBUNTU_OPTS) do |n| + @chef_run = ::ChefSpec::Runner.new(::UBUNTU_OPTS) do |n| n.set["openstack"]["block-storage"]["rabbit"]["ha"] = true end @chef_run.converge "openstack-block-storage::cinder-common" end it "has rabbit_hosts" do - expect(@chef_run).to create_file_with_content @file.name, - "rabbit_hosts=1.1.1.1:5672,2.2.2.2:5672" + expect(@chef_run).to render_file(@file.name).with_content("rabbit_hosts=1.1.1.1:5672,2.2.2.2:5672") end it "has rabbit_ha_queues" do - expect(@chef_run).to create_file_with_content @file.name, - "rabbit_ha_queues=True" + expect(@chef_run).to render_file(@file.name).with_content("rabbit_ha_queues=True") end it "does not have rabbit_host" do - expect(@chef_run).not_to create_file_with_content @file.name, - "rabbit_host=127.0.0.1" + expect(@chef_run).not_to render_file(@file.name).with_content("rabbit_host=127.0.0.1") end it "does not have rabbit_port" do - expect(@chef_run).not_to create_file_with_content @file.name, - "rabbit_port=5672" + expect(@chef_run).not_to render_file(@file.name).with_content("rabbit_port=5672") end end @@ -144,73 +130,59 @@ describe "openstack-block-storage::cinder-common" do end it "has qpid_hostname" do - expect(@chef_run).to create_file_with_content @file.name, - "qpid_hostname=127.0.0.1" + expect(@chef_run).to render_file(@file.name).with_content("qpid_hostname=127.0.0.1") end it "has qpid_port" do - expect(@chef_run).to create_file_with_content @file.name, - "qpid_port=5672" + expect(@chef_run).to render_file(@file.name).with_content("qpid_port=5672") end it "has qpid_username" do - expect(@chef_run).to create_file_with_content @file.name, - "qpid_username=" + expect(@chef_run).to render_file(@file.name).with_content("qpid_username=") end it "has qpid_password" do - expect(@chef_run).to create_file_with_content @file.name, - "qpid_password=" + expect(@chef_run).to render_file(@file.name).with_content("qpid_password=") end it "has qpid_sasl_mechanisms" do - expect(@chef_run).to create_file_with_content @file.name, - "qpid_sasl_mechanisms=" + expect(@chef_run).to render_file(@file.name).with_content("qpid_sasl_mechanisms=") end it "has qpid_reconnect_timeout" do - expect(@chef_run).to create_file_with_content @file.name, - "qpid_reconnect_timeout=0" + expect(@chef_run).to render_file(@file.name).with_content("qpid_reconnect_timeout=0") end it "has qpid_reconnect_limit" do - expect(@chef_run).to create_file_with_content @file.name, - "qpid_reconnect_limit=0" + expect(@chef_run).to render_file(@file.name).with_content("qpid_reconnect_limit=0") end it "has qpid_reconnect_interval_min" do - expect(@chef_run).to create_file_with_content @file.name, - "qpid_reconnect_interval_min=0" + expect(@chef_run).to render_file(@file.name).with_content("qpid_reconnect_interval_min=0") end it "has qpid_reconnect_interval_max" do - expect(@chef_run).to create_file_with_content @file.name, - "qpid_reconnect_interval_max=0" + expect(@chef_run).to render_file(@file.name).with_content("qpid_reconnect_interval_max=0") end it "has qpid_reconnect_interval" do - expect(@chef_run).to create_file_with_content @file.name, - "qpid_reconnect_interval=0" + expect(@chef_run).to render_file(@file.name).with_content("qpid_reconnect_interval=0") end it "has qpid_reconnect" do - expect(@chef_run).to create_file_with_content @file.name, - "qpid_reconnect=true" + expect(@chef_run).to render_file(@file.name).with_content("qpid_reconnect=true") end it "has qpid_heartbeat" do - expect(@chef_run).to create_file_with_content @file.name, - "qpid_heartbeat=60" + expect(@chef_run).to render_file(@file.name).with_content("qpid_heartbeat=60") end it "has qpid_protocol" do - expect(@chef_run).to create_file_with_content @file.name, - "qpid_protocol=tcp" + expect(@chef_run).to render_file(@file.name).with_content("qpid_protocol=tcp") end it "has qpid_tcp_nodelay" do - expect(@chef_run).to create_file_with_content @file.name, - "qpid_tcp_nodelay=true" + expect(@chef_run).to render_file(@file.name).with_content("qpid_tcp_nodelay=true") end end end diff --git a/spec/identity_registration_spec.rb b/spec/identity_registration_spec.rb index e6ed35c..00523f9 100644 --- a/spec/identity_registration_spec.rb +++ b/spec/identity_registration_spec.rb @@ -3,7 +3,7 @@ require_relative "spec_helper" describe "openstack-block-storage::identity_registration" do before do block_storage_stubs - @chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS + @chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS @chef_run.converge "openstack-block-storage::identity_registration" end @@ -14,15 +14,15 @@ describe "openstack-block-storage::identity_registration" do ).to_hash expect(resource).to include( - :auth_uri => "https://127.0.0.1:35357/v2.0", + :auth_uri => "http://127.0.0.1:35357/v2.0", :bootstrap_token => "bootstrap-token", :service_name => "cinder", :service_type => "volume", :service_description => "Cinder Volume Service", :endpoint_region => "RegionOne", - :endpoint_adminurl => "https://127.0.0.1:8776/v1/%(tenant_id)s", - :endpoint_internalurl => "https://127.0.0.1:8776/v1/%(tenant_id)s", - :endpoint_publicurl => "https://127.0.0.1:8776/v1/%(tenant_id)s", + :endpoint_adminurl => "http://127.0.0.1:8776/v1/%(tenant_id)s", + :endpoint_internalurl => "http://127.0.0.1:8776/v1/%(tenant_id)s", + :endpoint_publicurl => "http://127.0.0.1:8776/v1/%(tenant_id)s", :action => [:create_service] ) end @@ -34,15 +34,15 @@ describe "openstack-block-storage::identity_registration" do ).to_hash expect(resource).to include( - :auth_uri => "https://127.0.0.1:35357/v2.0", + :auth_uri => "http://127.0.0.1:35357/v2.0", :bootstrap_token => "bootstrap-token", :service_name => "cinder", :service_type => "volume", :service_description => "Cinder Volume Service", :endpoint_region => "RegionOne", - :endpoint_adminurl => "https://127.0.0.1:8776/v1/%(tenant_id)s", - :endpoint_internalurl => "https://127.0.0.1:8776/v1/%(tenant_id)s", - :endpoint_publicurl => "https://127.0.0.1:8776/v1/%(tenant_id)s", + :endpoint_adminurl => "http://127.0.0.1:8776/v1/%(tenant_id)s", + :endpoint_internalurl => "http://127.0.0.1:8776/v1/%(tenant_id)s", + :endpoint_publicurl => "http://127.0.0.1:8776/v1/%(tenant_id)s", :action => [:create_endpoint] ) end @@ -54,7 +54,7 @@ describe "openstack-block-storage::identity_registration" do ).to_hash expect(resource).to include( - :auth_uri => "https://127.0.0.1:35357/v2.0", + :auth_uri => "http://127.0.0.1:35357/v2.0", :bootstrap_token => "bootstrap-token", :tenant_name => "service", :user_name => "cinder", @@ -71,7 +71,7 @@ describe "openstack-block-storage::identity_registration" do ).to_hash expect(resource).to include( - :auth_uri => "https://127.0.0.1:35357/v2.0", + :auth_uri => "http://127.0.0.1:35357/v2.0", :bootstrap_token => "bootstrap-token", :tenant_name => "service", :user_name => "cinder", diff --git a/spec/scheduler-opensuse_spec.rb b/spec/scheduler-opensuse_spec.rb index 42de173..a72528f 100644 --- a/spec/scheduler-opensuse_spec.rb +++ b/spec/scheduler-opensuse_spec.rb @@ -4,7 +4,7 @@ describe "openstack-block-storage::scheduler" do before { block_storage_stubs } describe "opensuse" do before do - @chef_run = ::ChefSpec::ChefRunner.new ::OPENSUSE_OPTS + @chef_run = ::ChefSpec::Runner.new ::OPENSUSE_OPTS @chef_run.converge "openstack-block-storage::scheduler" end @@ -13,7 +13,7 @@ describe "openstack-block-storage::scheduler" do end it "does not upgrade stevedore" do - chef_run = ::ChefSpec::ChefRunner.new ::OPENSUSE_OPTS + chef_run = ::ChefSpec::Runner.new ::OPENSUSE_OPTS chef_run.converge "openstack-block-storage::scheduler" expect(chef_run).not_to upgrade_python_pip "stevedore" @@ -24,7 +24,7 @@ describe "openstack-block-storage::scheduler" do end it "installs postgresql python packages if explicitly told" do - chef_run = ::ChefSpec::ChefRunner.new ::OPENSUSE_OPTS + chef_run = ::ChefSpec::Runner.new ::OPENSUSE_OPTS node = chef_run.node node.set["openstack"]["db"]["volume"]["db_type"] = "postgresql" chef_run.converge "openstack-block-storage::scheduler" @@ -38,7 +38,7 @@ describe "openstack-block-storage::scheduler" do end it "starts cinder scheduler on boot" do - expect(@chef_run).to set_service_to_start_on_boot "openstack-cinder-scheduler" + expect(@chef_run).to enable_service "openstack-cinder-scheduler" end end end diff --git a/spec/scheduler-redhat_spec.rb b/spec/scheduler-redhat_spec.rb index e72d9f7..a4c803b 100644 --- a/spec/scheduler-redhat_spec.rb +++ b/spec/scheduler-redhat_spec.rb @@ -4,7 +4,7 @@ describe "openstack-block-storage::scheduler" do before { block_storage_stubs } describe "redhat" do before do - @chef_run = ::ChefSpec::ChefRunner.new ::REDHAT_OPTS + @chef_run = ::ChefSpec::Runner.new ::REDHAT_OPTS @chef_run.converge "openstack-block-storage::scheduler" end @@ -13,7 +13,7 @@ describe "openstack-block-storage::scheduler" do end it "does not upgrade stevedore" do - chef_run = ::ChefSpec::ChefRunner.new ::REDHAT_OPTS + chef_run = ::ChefSpec::Runner.new ::REDHAT_OPTS chef_run.converge "openstack-block-storage::scheduler" expect(chef_run).not_to upgrade_python_pip "stevedore" @@ -24,7 +24,7 @@ describe "openstack-block-storage::scheduler" do end it "installs postgresql python packages if explicitly told" do - chef_run = ::ChefSpec::ChefRunner.new ::REDHAT_OPTS + chef_run = ::ChefSpec::Runner.new ::REDHAT_OPTS node = chef_run.node node.set["openstack"]["db"]["volume"]["db_type"] = "postgresql" chef_run.converge "openstack-block-storage::scheduler" @@ -38,7 +38,7 @@ describe "openstack-block-storage::scheduler" do end it "starts cinder scheduler on boot" do - expect(@chef_run).to set_service_to_start_on_boot "openstack-cinder-scheduler" + expect(@chef_run).to enable_service "openstack-cinder-scheduler" end end end diff --git a/spec/scheduler_spec.rb b/spec/scheduler_spec.rb index 0839ec4..9eda58d 100644 --- a/spec/scheduler_spec.rb +++ b/spec/scheduler_spec.rb @@ -4,7 +4,7 @@ describe "openstack-block-storage::scheduler" do before { block_storage_stubs } describe "ubuntu" do before do - @chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS do |n| + @chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS do |n| n.set["openstack"]["block-storage"]["syslog"]["use"] = true end @chef_run.converge "openstack-block-storage::scheduler" @@ -13,7 +13,7 @@ describe "openstack-block-storage::scheduler" do expect_runs_openstack_common_logging_recipe it "doesn't run logging recipe" do - chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS + chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS chef_run.converge "openstack-block-storage::scheduler" expect(chef_run).not_to include_recipe "openstack-common::logging" @@ -28,7 +28,7 @@ describe "openstack-block-storage::scheduler" do end it "installs postgresql python packages if explicitly told" do - chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS + chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS node = chef_run.node node.set["openstack"]["db"]["volume"]["db_type"] = "postgresql" chef_run.converge "openstack-block-storage::scheduler" @@ -42,11 +42,11 @@ describe "openstack-block-storage::scheduler" do end it "starts cinder scheduler on boot" do - expect(@chef_run).to set_service_to_start_on_boot "cinder-scheduler" + expect(@chef_run).to enable_service "cinder-scheduler" end it "doesn't run logging recipe" do - expect(@chef_run).to set_service_to_start_on_boot "cinder-scheduler" + expect(@chef_run).to enable_service "cinder-scheduler" end it "doesn't setup cron when no metering" do @@ -57,7 +57,7 @@ describe "openstack-block-storage::scheduler" do ::Chef::Recipe.any_instance.stub(:search). with(:node, "roles:os-block-storage-scheduler"). and_return([OpenStruct.new(:name => "fauxhai.local")]) - chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS do |n| + chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS do |n| n.set["openstack"]["metering"] = true end chef_run.converge "openstack-block-storage::scheduler" @@ -78,7 +78,7 @@ describe "openstack-block-storage::scheduler" do ::Chef::Recipe.any_instance.stub(:search). with(:node, "roles:os-block-storage-scheduler"). and_return([OpenStruct.new(:name => "foobar")]) - chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS do |n| + chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS do |n| n.set["openstack"]["metering"] = true crontests.each do |k,v| n.set["openstack"]["block-storage"]["cron"][k.to_s] = v diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 0bf1382..f60d171 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,5 +1,6 @@ require "chefspec" require "chef/application" +require_relative "support/matcher" ::LOG_LEVEL = :fatal ::OPENSUSE_OPTS = { @@ -49,7 +50,8 @@ def expect_creates_cinder_conf service, user, group, action=:restart end it "has proper owner" do - expect(@file).to be_owned_by user, group + expect(@file.owner).to eq(user) + expect(@file.group).to eq(group) end it "has proper modes" do @@ -57,7 +59,7 @@ def expect_creates_cinder_conf service, user, group, action=:restart end it "notifies service restart" do - expect(@file).to notify service, action + expect(@file).to notify(service).to(action) end end end @@ -69,7 +71,8 @@ def expect_creates_policy_json service, user, group, action=:restart end it "has proper owner" do - expect(@file).to be_owned_by user, group + expect(@file.owner).to eq(user) + expect(@file.group).to eq(group) end it "has proper modes" do @@ -77,7 +80,7 @@ def expect_creates_policy_json service, user, group, action=:restart end it "notifies service restart" do - expect(@file).to notify service, action + expect(@file).to notify(service).to(action) end end end diff --git a/spec/support/matcher.rb b/spec/support/matcher.rb new file mode 100644 index 0000000..91025da --- /dev/null +++ b/spec/support/matcher.rb @@ -0,0 +1,3 @@ +def upgrade_python_pip(pkgname) + ChefSpec::Matchers::ResourceMatcher.new(:python_pip, :upgrade, pkgname) +end diff --git a/spec/volume-opensuse_spec.rb b/spec/volume-opensuse_spec.rb index e5b7537..e971866 100644 --- a/spec/volume-opensuse_spec.rb +++ b/spec/volume-opensuse_spec.rb @@ -4,7 +4,7 @@ describe "openstack-block-storage::volume" do before { block_storage_stubs } describe "opensuse" do before do - @chef_run = ::ChefSpec::ChefRunner.new ::OPENSUSE_OPTS + @chef_run = ::ChefSpec::Runner.new ::OPENSUSE_OPTS @chef_run.converge "openstack-block-storage::volume" end @@ -17,7 +17,7 @@ describe "openstack-block-storage::volume" do end it "installs postgresql python packages if explicitly told" do - chef_run = ::ChefSpec::ChefRunner.new ::OPENSUSE_OPTS + chef_run = ::ChefSpec::Runner.new ::OPENSUSE_OPTS node = chef_run.node node.set["openstack"]["db"]["volume"]["db_type"] = "postgresql" chef_run.converge "openstack-block-storage::volume" @@ -36,15 +36,15 @@ describe "openstack-block-storage::volume" do it "starts cinder volume on boot" do expected = "openstack-cinder-volume" - expect(@chef_run).to set_service_to_start_on_boot expected + expect(@chef_run).to enable_service expected end it "starts iscsi target on boot" do - expect(@chef_run).to set_service_to_start_on_boot "tgtd" + expect(@chef_run).to enable_service "tgtd" end it "installs nfs packages" do - chef_run = ::ChefSpec::ChefRunner.new ::OPENSUSE_OPTS do |n| + chef_run = ::ChefSpec::Runner.new ::OPENSUSE_OPTS do |n| n.set["openstack"]["block-storage"]["volume"]["driver"] = "cinder.volume.drivers.netapp.nfs.NetAppDirect7modeNfsDriver" end chef_run.converge "openstack-block-storage::volume" @@ -56,10 +56,8 @@ describe "openstack-block-storage::volume" do it "has opensuse include" do file = "/etc/tgt/targets.conf" - expect(@chef_run).to create_file_with_content file, - "include /var/lib/cinder/volumes/*" - expect(@chef_run).not_to create_file_with_content file, - "include /etc/tgt/conf.d/*.conf" + expect(@chef_run).to render_file(file).with_content("include /var/lib/cinder/volumes/*") + expect(@chef_run).not_to render_file(file).with_content("include /etc/tgt/conf.d/*.conf") end end end diff --git a/spec/volume-redhat_spec.rb b/spec/volume-redhat_spec.rb index 0638f82..2aea295 100644 --- a/spec/volume-redhat_spec.rb +++ b/spec/volume-redhat_spec.rb @@ -4,7 +4,7 @@ describe "openstack-block-storage::volume" do before { block_storage_stubs } describe "redhat" do before do - @chef_run = ::ChefSpec::ChefRunner.new ::REDHAT_OPTS + @chef_run = ::ChefSpec::Runner.new ::REDHAT_OPTS @chef_run.converge "openstack-block-storage::volume" end @@ -13,7 +13,7 @@ describe "openstack-block-storage::volume" do end it "installs postgresql python packages if explicitly told" do - chef_run = ::ChefSpec::ChefRunner.new ::REDHAT_OPTS + chef_run = ::ChefSpec::Runner.new ::REDHAT_OPTS node = chef_run.node node.set["openstack"]["db"]["volume"]["db_type"] = "postgresql" chef_run.converge "openstack-block-storage::volume" @@ -32,15 +32,15 @@ describe "openstack-block-storage::volume" do it "starts cinder volume on boot" do expected = "openstack-cinder-volume" - expect(@chef_run).to set_service_to_start_on_boot expected + expect(@chef_run).to enable_service expected end it "starts iscsi target on boot" do - expect(@chef_run).to set_service_to_start_on_boot "tgtd" + expect(@chef_run).to enable_service "tgtd" end it "installs nfs packages" do - chef_run = ::ChefSpec::ChefRunner.new ::REDHAT_OPTS do |n| + chef_run = ::ChefSpec::Runner.new ::REDHAT_OPTS do |n| n.set["openstack"]["block-storage"]["volume"]["driver"] = "cinder.volume.drivers.netapp.nfs.NetAppDirect7modeNfsDriver" end chef_run.converge "openstack-block-storage::volume" @@ -52,10 +52,8 @@ describe "openstack-block-storage::volume" do it "has redhat include" do file = "/etc/tgt/targets.conf" - expect(@chef_run).to create_file_with_content file, - "include /var/lib/cinder/volumes/*" - expect(@chef_run).not_to create_file_with_content file, - "include /etc/tgt/conf.d/*.conf" + expect(@chef_run).to render_file(file).with_content("include /var/lib/cinder/volumes/*") + expect(@chef_run).not_to render_file(file).with_content("include /etc/tgt/conf.d/*.conf") end end end diff --git a/spec/volume_spec.rb b/spec/volume_spec.rb index 7360791..b44460f 100644 --- a/spec/volume_spec.rb +++ b/spec/volume_spec.rb @@ -4,7 +4,7 @@ describe "openstack-block-storage::volume" do before { block_storage_stubs } describe "ubuntu" do before do - @chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS do |n| + @chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS do |n| n.set["openstack"]["block-storage"]["syslog"]["use"] = true end @chef_run.converge "openstack-block-storage::volume" @@ -13,7 +13,7 @@ describe "openstack-block-storage::volume" do expect_runs_openstack_common_logging_recipe it "doesn't run logging recipe" do - chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS + chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS chef_run.converge "openstack-block-storage::volume" expect(chef_run).not_to include_recipe "openstack-common::logging" @@ -28,7 +28,7 @@ describe "openstack-block-storage::volume" do end it "installs postgresql python packages if explicitly told" do - chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS + chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS node = chef_run.node node.set["openstack"]["db"]["volume"]["db_type"] = "postgresql" chef_run.converge "openstack-block-storage::volume" @@ -42,7 +42,7 @@ describe "openstack-block-storage::volume" do end it "installs nfs packages" do - chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS do |n| + chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS do |n| n.set["openstack"]["block-storage"]["volume"]["driver"] = "cinder.volume.drivers.netapp.nfs.NetAppDirect7modeNfsDriver" end chef_run.converge "openstack-block-storage::volume" @@ -51,7 +51,7 @@ describe "openstack-block-storage::volume" do end it "creates the nfs mount point" do - chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS do |n| + chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS do |n| n.set["openstack"]["block-storage"]["volume"]["driver"] = "cinder.volume.drivers.netapp.nfs.NetAppDirect7modeNfsDriver" end chef_run.converge "openstack-block-storage::volume" @@ -62,7 +62,7 @@ describe "openstack-block-storage::volume" do it "configures netapp dfm password" do ::Chef::Recipe.any_instance.stub(:service_password).with("netapp"). and_return "netapp-pass" - chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS do |n| + chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS do |n| n.set["openstack"]["block-storage"]["volume"]["driver"] = "cinder.volume.drivers.netapp.iscsi.NetAppISCSIDriver" end chef_run.converge "openstack-block-storage::volume" @@ -74,7 +74,7 @@ describe "openstack-block-storage::volume" do it "configures rbd password" do ::Chef::Recipe.any_instance.stub(:service_password).with("rbd"). and_return "rbd-pass" - chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS do |n| + chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS do |n| n.set["openstack"]["block-storage"]["volume"]["driver"] = "cinder.volume.drivers.RBDDriver" end chef_run.converge "openstack-block-storage::volume" @@ -88,13 +88,13 @@ describe "openstack-block-storage::volume" do end it "starts cinder volume on boot" do - expect(@chef_run).to set_service_to_start_on_boot "cinder-volume" + expect(@chef_run).to enable_service "cinder-volume" end expect_creates_cinder_conf "service[cinder-volume]", "cinder", "cinder" it "starts iscsi target on boot" do - expect(@chef_run).to set_service_to_start_on_boot "tgt" + expect(@chef_run).to enable_service "tgt" end describe "targets.conf" do @@ -107,14 +107,12 @@ describe "openstack-block-storage::volume" do end it "notifies iscsi restart" do - expect(@file).to notify "service[iscsitarget]", :restart + expect(@file).to notify("service[iscsitarget]").to(:restart) end it "has ubuntu include" do - expect(@chef_run).to create_file_with_content @file.name, - "include /etc/tgt/conf.d/*.conf" - expect(@chef_run).not_to create_file_with_content @file.name, - "include /var/lib/cinder/volumes/*" + expect(@chef_run).to render_file(@file.name).with_content("include /etc/tgt/conf.d/*.conf") + expect(@chef_run).not_to render_file(@file.name).with_content("include /var/lib/cinder/volumes/*") end end end