From 9063c86e8f39a3e05a84cf3a6569159c73e3cc17 Mon Sep 17 00:00:00 2001 From: Lukas Bezdicka Date: Mon, 11 May 2015 13:35:26 +0200 Subject: [PATCH] Update glance to 0db42a6a60bd4952f795d61ea26ed299e8c35bc8 0db42a6a60bd4952f795d61ea26ed299e8c35bc8 Merge "Fix spec tests for RSpec 3.x and Puppet 4.x" 1d388344661b056c45e79e3c189f82db6ed0d69b make service description configurable 60de7b77df0d3705e7b18cf346651d3922b47e3d Fix spec tests for RSpec 3.x and Puppet 4.x b76fbcbea34b510191964cc3ed6a4c8e6f2acbfe glance provider: pick os_region_name from DEFAULT 9f345f97d12af09685c86fb236c3bf44273b10d6 Bump rspec-puppet to 2.1.0 15e08072566e7c05abeff9c73079fc16f1b9cb8f Merge "Revert "Revert "Fix os_region_name in provider""" 5609850a577050aa7a6692e41bbd3abc5cd1fed7 Merge "Revert "Fix os_region_name in provider"" b803a9a983bfd09c40e94bcb8a5ca10348af38ae Merge "Revert "Move rabbit/kombu settings to oslo_messaging_rabbit section"" a758389de6e6b22a20a716905f55df973b11bef9 Merge "MySQL: change default MySQL collate to utf8_general_ci" 2f614cf9fd15a5348ac11eb617e63883598f0497 MySQL: change default MySQL collate to utf8_general_ci 79d307044a3b2189278fdcb230625a6eae282d27 Beaker tests 62c42a5f6122d146f8c4e292c878cdd3e958a85f Revert "Revert "Fix os_region_name in provider"" e2301958e9dd4086fb6f5689499e5bb39e87e208 Revert "Fix os_region_name in provider" d302170d260f4e6585fedc1b4709c953d0491c56 Revert "Move rabbit/kombu settings to oslo_messaging_rabbit section" --- Puppetfile | 2 +- glance/Gemfile | 3 +- glance/README.md | 12 +++ glance/lib/puppet/provider/glance.rb | 8 +- glance/manifests/api.pp | 8 +- glance/manifests/db/mysql.pp | 4 +- glance/manifests/keystone/auth.pp | 8 +- glance/manifests/notify/rabbitmq.pp | 46 +++++----- glance/spec/acceptance/class_spec.rb | 86 +++++++++++++++++++ .../acceptance/nodesets/centos-70-x64.yml | 9 ++ glance/spec/acceptance/nodesets/default.yml | 11 +++ .../acceptance/nodesets/nodepool-centos7.yml | 9 ++ .../acceptance/nodesets/nodepool-trusty.yml | 9 ++ glance/spec/acceptance/nodesets/nodepool.yml | 9 ++ .../nodesets/ubuntu-server-1404-x64.yml | 11 +++ glance/spec/classes/glance_api_spec.rb | 11 +-- glance/spec/classes/glance_db_mysql_spec.rb | 3 +- .../spec/classes/glance_keystone_auth_spec.rb | 6 +- .../classes/glance_notify_rabbitmq_spec.rb | 78 ++++++++--------- glance/spec/classes/glance_registry_spec.rb | 2 +- glance/spec/spec_helper_acceptance.rb | 46 ++++++++++ glance/spec/unit/provider/glance_spec.rb | 2 +- 22 files changed, 292 insertions(+), 91 deletions(-) create mode 100644 glance/spec/acceptance/class_spec.rb create mode 100644 glance/spec/acceptance/nodesets/centos-70-x64.yml create mode 100644 glance/spec/acceptance/nodesets/default.yml create mode 100644 glance/spec/acceptance/nodesets/nodepool-centos7.yml create mode 100644 glance/spec/acceptance/nodesets/nodepool-trusty.yml create mode 100644 glance/spec/acceptance/nodesets/nodepool.yml create mode 100644 glance/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml create mode 100644 glance/spec/spec_helper_acceptance.rb diff --git a/Puppetfile b/Puppetfile index ea86724d0..b325c2239 100644 --- a/Puppetfile +++ b/Puppetfile @@ -43,7 +43,7 @@ mod 'galera', :git => 'https://github.com/redhat-openstack/puppet-galera.git' mod 'glance', - :commit => 'eaddd54d8ac87571a01046b5da7dbca33f3b3a59', + :commit => '0db42a6a60bd4952f795d61ea26ed299e8c35bc8', :git => 'https://github.com/stackforge/puppet-glance.git' mod 'gluster', diff --git a/glance/Gemfile b/glance/Gemfile index b0b2d45ff..571fd65dc 100644 --- a/glance/Gemfile +++ b/glance/Gemfile @@ -2,7 +2,7 @@ source 'https://rubygems.org' group :development, :test do gem 'puppetlabs_spec_helper', :require => false - gem 'rspec-puppet', '~> 2.0.0', :require => false + gem 'rspec-puppet', '~> 2.1.0', :require => false gem 'metadata-json-lint' gem 'puppet-lint-param-docs' @@ -16,6 +16,7 @@ group :development, :test do gem 'puppet-lint-variable_contains_upcase' gem 'puppet-lint-numericvariable' + gem 'beaker-rspec', '~> 2.2.4', :require => false gem 'json' gem 'webmock' end diff --git a/glance/README.md b/glance/README.md index ae3a74957..f0f225aa8 100644 --- a/glance/README.md +++ b/glance/README.md @@ -118,6 +118,18 @@ Limitations * Only supports configuring the file, swift and rbd storage backends. +Beaker-Rspec +------------ + +This module has beaker-rspec tests + +To run: + +```shell +bundle install +bundle exec rspec spec/acceptance +``` + Development ----------- diff --git a/glance/lib/puppet/provider/glance.rb b/glance/lib/puppet/provider/glance.rb index 2501d63c9..6f7bbee06 100644 --- a/glance/lib/puppet/provider/glance.rb +++ b/glance/lib/puppet/provider/glance.rb @@ -16,7 +16,7 @@ def self.get_glance_credentials glance_file['keystone_authtoken']['admin_tenant_name'] and glance_file['keystone_authtoken']['admin_user'] and glance_file['keystone_authtoken']['admin_password'] and - glance_file['glance_store']['os_region_name'] + glance_file['DEFAULT']['os_region_name'] g = {} g['auth_host'] = glance_file['keystone_authtoken']['auth_host'].strip @@ -25,7 +25,7 @@ def self.get_glance_credentials g['admin_tenant_name'] = glance_file['keystone_authtoken']['admin_tenant_name'].strip g['admin_user'] = glance_file['keystone_authtoken']['admin_user'].strip g['admin_password'] = glance_file['keystone_authtoken']['admin_password'].strip - g['os_region_name'] = glance_file['glance_store']['os_region_name'].strip + g['os_region_name'] = glance_file['DEFAULT']['os_region_name'].strip # auth_admin_prefix not required to be set. g['auth_admin_prefix'] = (glance_file['keystone_authtoken']['auth_admin_prefix'] || '').strip @@ -36,14 +36,14 @@ def self.get_glance_credentials glance_file['keystone_authtoken']['admin_tenant_name'] and glance_file['keystone_authtoken']['admin_user'] and glance_file['keystone_authtoken']['admin_password'] and - glance_file['glance_store']['os_region_name'] + glance_file['DEFAULT']['os_region_name'] g = {} g['identity_uri'] = glance_file['keystone_authtoken']['identity_uri'].strip g['admin_tenant_name'] = glance_file['keystone_authtoken']['admin_tenant_name'].strip g['admin_user'] = glance_file['keystone_authtoken']['admin_user'].strip g['admin_password'] = glance_file['keystone_authtoken']['admin_password'].strip - g['os_region_name'] = glance_file['glance_store']['os_region_name'].strip + g['os_region_name'] = glance_file['DEFAULT']['os_region_name'].strip return g else diff --git a/glance/manifests/api.pp b/glance/manifests/api.pp index 26dc0b386..db6a279eb 100644 --- a/glance/manifests/api.pp +++ b/glance/manifests/api.pp @@ -299,7 +299,7 @@ 'DEFAULT/workers': value => $workers; 'DEFAULT/show_image_direct_url': value => $show_image_direct_url; 'DEFAULT/image_cache_dir': value => $image_cache_dir; - 'glance_store/os_region_name': value => $os_region_name; + 'DEFAULT/os_region_name': value => $os_region_name; } # known_stores config @@ -314,9 +314,9 @@ } glance_cache_config { - 'DEFAULT/verbose': value => $verbose; - 'DEFAULT/debug': value => $debug; - 'glance_store/os_region_name': value => $os_region_name; + 'DEFAULT/verbose': value => $verbose; + 'DEFAULT/debug': value => $debug; + 'DEFAULT/os_region_name': value => $os_region_name; } # configure api service to connect registry service diff --git a/glance/manifests/db/mysql.pp b/glance/manifests/db/mysql.pp index 4f31b3b25..f0b2090ad 100644 --- a/glance/manifests/db/mysql.pp +++ b/glance/manifests/db/mysql.pp @@ -24,7 +24,7 @@ # the database charset. Optional. Defaults to 'utf8' # # [*collate*] -# the database collation. Optional. Defaults to 'utf8_unicode_ci' +# the database collation. Optional. Defaults to 'utf8_general_ci' # # [*mysql_module*] # (optional) Deprecated. Does nothing. @@ -40,7 +40,7 @@ $host = '127.0.0.1', $allowed_hosts = undef, $charset = 'utf8', - $collate = 'utf8_unicode_ci', + $collate = 'utf8_general_ci', $cluster_id = 'localzone', $mysql_module = undef, ) { diff --git a/glance/manifests/keystone/auth.pp b/glance/manifests/keystone/auth.pp index 9544b1969..463ba6bf2 100644 --- a/glance/manifests/keystone/auth.pp +++ b/glance/manifests/keystone/auth.pp @@ -57,6 +57,9 @@ # [*admin_protocol*] # Protocol for admin endpoint. Optional. Defaults to 'http'. # +# [*service_description*] +# Description for keystone service. Optional. Defaults to 'OpenStack Image Service''. +# class glance::keystone::auth( $password, $email = 'glance@localhost', @@ -74,7 +77,8 @@ $tenant = 'services', $public_protocol = 'http', $admin_protocol = 'http', - $internal_protocol = 'http' + $internal_protocol = 'http', + $service_description = 'OpenStack Image Service', ) { if $service_name == undef { @@ -92,7 +96,7 @@ configure_user_role => $configure_user_role, configure_endpoint => $configure_endpoint, service_type => $service_type, - service_description => 'OpenStack Image Service', + service_description => $service_description, service_name => $real_service_name, region => $region, password => $password, diff --git a/glance/manifests/notify/rabbitmq.pp b/glance/manifests/notify/rabbitmq.pp index a55434926..a4b2c4a81 100644 --- a/glance/manifests/notify/rabbitmq.pp +++ b/glance/manifests/notify/rabbitmq.pp @@ -87,55 +87,55 @@ if $rabbit_hosts { glance_api_config { - 'oslo_messaging_rabbit/rabbit_hosts': value => join($rabbit_hosts, ','); - 'oslo_messaging_rabbit/rabbit_ha_queues': value => true + 'DEFAULT/rabbit_hosts': value => join($rabbit_hosts, ','); + 'DEFAULT/rabbit_ha_queues': value => true } } else { glance_api_config { - 'oslo_messaging_rabbit/rabbit_host': value => $rabbit_host; - 'oslo_messaging_rabbit/rabbit_port': value => $rabbit_port; - 'oslo_messaging_rabbit/rabbit_hosts': value => "${rabbit_host}:${rabbit_port}"; - 'oslo_messaging_rabbit/rabbit_ha_queues': value => false + 'DEFAULT/rabbit_host': value => $rabbit_host; + 'DEFAULT/rabbit_port': value => $rabbit_port; + 'DEFAULT/rabbit_hosts': value => "${rabbit_host}:${rabbit_port}"; + 'DEFAULT/rabbit_ha_queues': value => false } } glance_api_config { 'DEFAULT/notification_driver': value => $notification_driver; - 'oslo_messaging_rabbit/rabbit_virtual_host': value => $rabbit_virtual_host; - 'oslo_messaging_rabbit/rabbit_password': value => $rabbit_password, secret => true; - 'oslo_messaging_rabbit/rabbit_userid': value => $rabbit_userid; - 'oslo_messaging_rabbit/rabbit_notification_exchange': value => $rabbit_notification_exchange; - 'oslo_messaging_rabbit/rabbit_notification_topic': value => $rabbit_notification_topic; - 'oslo_messaging_rabbit/rabbit_use_ssl': value => $rabbit_use_ssl; + 'DEFAULT/rabbit_virtual_host': value => $rabbit_virtual_host; + 'DEFAULT/rabbit_password': value => $rabbit_password, secret => true; + 'DEFAULT/rabbit_userid': value => $rabbit_userid; + 'DEFAULT/rabbit_notification_exchange': value => $rabbit_notification_exchange; + 'DEFAULT/rabbit_notification_topic': value => $rabbit_notification_topic; + 'DEFAULT/rabbit_use_ssl': value => $rabbit_use_ssl; 'DEFAULT/amqp_durable_queues': value => $amqp_durable_queues_real; } if $rabbit_use_ssl { - glance_api_config { 'oslo_messaging_rabbit/kombu_ssl_version': value => $kombu_ssl_version } + glance_api_config { 'DEFAULT/kombu_ssl_version': value => $kombu_ssl_version } if $kombu_ssl_ca_certs { - glance_api_config { 'oslo_messaging_rabbit/kombu_ssl_ca_certs': value => $kombu_ssl_ca_certs } + glance_api_config { 'DEFAULT/kombu_ssl_ca_certs': value => $kombu_ssl_ca_certs } } else { - glance_api_config { 'oslo_messaging_rabbit/kombu_ssl_ca_certs': ensure => absent} + glance_api_config { 'DEFAULT/kombu_ssl_ca_certs': ensure => absent} } if $kombu_ssl_certfile { - glance_api_config { 'oslo_messaging_rabbit/kombu_ssl_certfile': value => $kombu_ssl_certfile } + glance_api_config { 'DEFAULT/kombu_ssl_certfile': value => $kombu_ssl_certfile } } else { - glance_api_config { 'oslo_messaging_rabbit/kombu_ssl_certfile': ensure => absent} + glance_api_config { 'DEFAULT/kombu_ssl_certfile': ensure => absent} } if $kombu_ssl_keyfile { - glance_api_config { 'oslo_messaging_rabbit/kombu_ssl_keyfile': value => $kombu_ssl_keyfile } + glance_api_config { 'DEFAULT/kombu_ssl_keyfile': value => $kombu_ssl_keyfile } } else { - glance_api_config { 'oslo_messaging_rabbit/kombu_ssl_keyfile': ensure => absent} + glance_api_config { 'DEFAULT/kombu_ssl_keyfile': ensure => absent} } } else { glance_api_config { - 'oslo_messaging_rabbit/kombu_ssl_version': ensure => absent; - 'oslo_messaging_rabbit/kombu_ssl_ca_certs': ensure => absent; - 'oslo_messaging_rabbit/kombu_ssl_certfile': ensure => absent; - 'oslo_messaging_rabbit/kombu_ssl_keyfile': ensure => absent; + 'DEFAULT/kombu_ssl_version': ensure => absent; + 'DEFAULT/kombu_ssl_ca_certs': ensure => absent; + 'DEFAULT/kombu_ssl_certfile': ensure => absent; + 'DEFAULT/kombu_ssl_keyfile': ensure => absent; } if ($kombu_ssl_keyfile or $kombu_ssl_certfile or $kombu_ssl_ca_certs) { notice('Configuration of certificates with $rabbit_use_ssl == false is a useless config') diff --git a/glance/spec/acceptance/class_spec.rb b/glance/spec/acceptance/class_spec.rb new file mode 100644 index 000000000..c580d602d --- /dev/null +++ b/glance/spec/acceptance/class_spec.rb @@ -0,0 +1,86 @@ +require 'spec_helper_acceptance' + +describe 'glance class' do + + context 'default parameters' do + + it 'should work with no errors' do + pp= <<-EOS + Exec { logoutput => 'on_failure' } + + # Common resources + case $::osfamily { + 'Debian': { + include ::apt + # some packages are not autoupgraded in trusty. + # it will be fixed in liberty, but broken in kilo. + $need_to_be_upgraded = ['python-tz', 'python-pbr'] + apt::source { 'trusty-updates-kilo': + location => 'http://ubuntu-cloud.archive.canonical.com/ubuntu/', + release => 'trusty-updates', + required_packages => 'ubuntu-cloud-keyring', + repos => 'kilo/main', + trusted_source => true, + } -> + package { $need_to_be_upgraded: + ensure => latest, + } + } + 'RedHat': { + include ::epel # Get our epel on + } + } + class { '::mysql::server': } + + # Keystone resources, needed by Glance to run + class { '::keystone::db::mysql': + # https://bugs.launchpad.net/puppet-keystone/+bug/1446375 + collate => 'utf8_general_ci', + password => 'keystone', + } + class { '::keystone': + verbose => true, + debug => true, + database_connection => 'mysql://keystone:keystone@127.0.0.1/keystone', + admin_token => 'admin_token', + enabled => true, + } + class { '::keystone::roles::admin': + email => 'test@example.tld', + password => 'a_big_secret', + } + class { '::keystone::endpoint': + public_url => "https://${::fqdn}:5000/", + admin_url => "https://${::fqdn}:35357/", + } + + # Glance resources + include ::glance + include ::glance::client + class { '::glance::db::mysql': + # https://bugs.launchpad.net/puppet-glance/+bug/1446375 + collate => 'utf8_general_ci', + password => 'a_big_secret', + } + class { '::glance::keystone::auth': + password => 'a_big_secret', + } + class { '::glance::api': + database_connection => 'mysql://glance:a_big_secret@127.0.0.1/glance?charset=utf8', + verbose => false, + keystone_password => 'big_secret', + } + class { '::glance::registry': + database_connection => 'mysql://glance:a_big_secret@127.0.0.1/glance?charset=utf8', + verbose => false, + keystone_password => 'a_big_secret', + } + EOS + + # Run it twice and test for idempotency + apply_manifest(pp, :catch_failures => true) + apply_manifest(pp, :catch_changes => true) + end + + end +end diff --git a/glance/spec/acceptance/nodesets/centos-70-x64.yml b/glance/spec/acceptance/nodesets/centos-70-x64.yml new file mode 100644 index 000000000..cffc417f0 --- /dev/null +++ b/glance/spec/acceptance/nodesets/centos-70-x64.yml @@ -0,0 +1,9 @@ +HOSTS: + centos-70-x64: + roles: + - master + platform: el-7-x86_64 + box : puppetlabs/centos-7.0-64-nocm + hypervisor : vagrant +CONFIG: + type: foss diff --git a/glance/spec/acceptance/nodesets/default.yml b/glance/spec/acceptance/nodesets/default.yml new file mode 100644 index 000000000..0070b84c7 --- /dev/null +++ b/glance/spec/acceptance/nodesets/default.yml @@ -0,0 +1,11 @@ +HOSTS: + ubuntu-server-1404-x64: + roles: + - master + platform: ubuntu-14.04-amd64 + box : trusty-server-cloudimg-amd64-vagrant-disk1 + box_url : puppetlabs/ubuntu-14.04-64-nocm + hypervisor : vagrant +CONFIG: + log_level : debug + type: git diff --git a/glance/spec/acceptance/nodesets/nodepool-centos7.yml b/glance/spec/acceptance/nodesets/nodepool-centos7.yml new file mode 100644 index 000000000..aed4f0b26 --- /dev/null +++ b/glance/spec/acceptance/nodesets/nodepool-centos7.yml @@ -0,0 +1,9 @@ +HOSTS: + centos-70-x64: + roles: + - master + platform: el-7-x86_64 + hypervisor : none + ip: 127.0.0.1 +CONFIG: + type: foss diff --git a/glance/spec/acceptance/nodesets/nodepool-trusty.yml b/glance/spec/acceptance/nodesets/nodepool-trusty.yml new file mode 100644 index 000000000..757ba9851 --- /dev/null +++ b/glance/spec/acceptance/nodesets/nodepool-trusty.yml @@ -0,0 +1,9 @@ +HOSTS: + ubuntu-server-1404-x64: + roles: + - master + platform: ubuntu-14.04-amd64 + hypervisor : none + ip: 127.0.0.1 +CONFIG: + type: foss diff --git a/glance/spec/acceptance/nodesets/nodepool.yml b/glance/spec/acceptance/nodesets/nodepool.yml new file mode 100644 index 000000000..757ba9851 --- /dev/null +++ b/glance/spec/acceptance/nodesets/nodepool.yml @@ -0,0 +1,9 @@ +HOSTS: + ubuntu-server-1404-x64: + roles: + - master + platform: ubuntu-14.04-amd64 + hypervisor : none + ip: 127.0.0.1 +CONFIG: + type: foss diff --git a/glance/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml b/glance/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml new file mode 100644 index 000000000..0070b84c7 --- /dev/null +++ b/glance/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml @@ -0,0 +1,11 @@ +HOSTS: + ubuntu-server-1404-x64: + roles: + - master + platform: ubuntu-14.04-amd64 + box : trusty-server-cloudimg-amd64-vagrant-disk1 + box_url : puppetlabs/ubuntu-14.04-64-nocm + hypervisor : vagrant +CONFIG: + log_level : debug + type: git diff --git a/glance/spec/classes/glance_api_spec.rb b/glance/spec/classes/glance_api_spec.rb index bdac287a0..74e486265 100644 --- a/glance/spec/classes/glance_api_spec.rb +++ b/glance/spec/classes/glance_api_spec.rb @@ -103,6 +103,7 @@ 'registry_port', 'registry_client_protocol', 'show_image_direct_url', + 'os_region_name', ].each do |config| is_expected.to contain_glance_api_config("DEFAULT/#{config}").with_value(param_hash[config.intern]) end @@ -114,17 +115,9 @@ 'debug', 'registry_host', 'registry_port', - ].each do |config| - is_expected.to contain_glance_cache_config("DEFAULT/#{config}").with_value(param_hash[config.intern]) - end - end - - it 'is_expected.to lay down default glance_store api and cache config' do - [ 'os_region_name', ].each do |config| - is_expected.to contain_glance_cache_config("glance_store/#{config}").with_value(param_hash[config.intern]) - is_expected.to contain_glance_api_config("glance_store/#{config}").with_value(param_hash[config.intern]) + is_expected.to contain_glance_cache_config("DEFAULT/#{config}").with_value(param_hash[config.intern]) end end diff --git a/glance/spec/classes/glance_db_mysql_spec.rb b/glance/spec/classes/glance_db_mysql_spec.rb index 7db098b19..d2da9e338 100644 --- a/glance/spec/classes/glance_db_mysql_spec.rb +++ b/glance/spec/classes/glance_db_mysql_spec.rb @@ -20,7 +20,8 @@ it { is_expected.to contain_openstacklib__db__mysql('glance').with( :password_hash => '*41C910F70EB213CF4CB7B2F561B4995503C0A87B', - :charset => 'utf8' + :charset => 'utf8', + :collate => 'utf8_general_ci', )} end diff --git a/glance/spec/classes/glance_keystone_auth_spec.rb b/glance/spec/classes/glance_keystone_auth_spec.rb index 8e0293a89..a78527d4f 100644 --- a/glance/spec/classes/glance_keystone_auth_spec.rb +++ b/glance/spec/classes/glance_keystone_auth_spec.rb @@ -15,7 +15,7 @@ it { is_expected.to contain_keystone_user_role('glance@services').with( :ensure => 'present', - :roles => 'admin' + :roles => ['admin'] ) } it { is_expected.to contain_keystone_service('glance').with( @@ -50,7 +50,7 @@ it { is_expected.to contain_keystone_user_role('glancey@services').with( :ensure => 'present', - :roles => 'admin' + :roles => ['admin'] ) } it { is_expected.to contain_keystone_service('glancey').with( @@ -153,7 +153,7 @@ } end - it { is_expected.to contain_keystone_endpoint('RegionOne/glance').with_notify('Service[glance-api]') } + it { is_expected.to contain_keystone_endpoint('RegionOne/glance').with_notify(["Service[glance-api]"]) } end describe 'when overriding service name' do diff --git a/glance/spec/classes/glance_notify_rabbitmq_spec.rb b/glance/spec/classes/glance_notify_rabbitmq_spec.rb index 7f5f76fa0..bd9a1473b 100644 --- a/glance/spec/classes/glance_notify_rabbitmq_spec.rb +++ b/glance/spec/classes/glance_notify_rabbitmq_spec.rb @@ -15,17 +15,17 @@ {:rabbit_password => 'pass'} end it { is_expected.to contain_glance_api_config('DEFAULT/notification_driver').with_value('messaging') } - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_password').with_value('pass') } - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_password').with_value(params[:rabbit_password]).with_secret(true) } - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_userid').with_value('guest') } - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_host').with_value('localhost') } - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_port').with_value('5672') } - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_hosts').with_value('localhost:5672') } - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('false') } + it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_password').with_value('pass') } + it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_password').with_value(params[:rabbit_password]).with_secret(true) } + it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_userid').with_value('guest') } + it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_host').with_value('localhost') } + it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_port').with_value('5672') } + it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_hosts').with_value('localhost:5672') } + it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_ha_queues').with_value('false') } it { is_expected.to contain_glance_api_config('DEFAULT/amqp_durable_queues').with_value('false') } - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_virtual_host').with_value('/') } - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_notification_exchange').with_value('glance') } - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_notification_topic').with_value('notifications') } + it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_virtual_host').with_value('/') } + it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_notification_exchange').with_value('glance') } + it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_notification_topic').with_value('notifications') } end describe 'when passing params and use ssl' do @@ -38,15 +38,15 @@ :rabbit_use_ssl => true, :rabbit_durable_queues => true, } - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_userid').with_value('guest2') } - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_host').with_value('localhost2') } - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_port').with_value('5673') } - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value('true') } - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_ca_certs').with_ensure('absent') } - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_ensure('absent') } - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_ensure('absent') } - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_version').with_value('TLSv1') } - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_durable_queues').with_value('true') } + it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_userid').with_value('guest2') } + it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_host').with_value('localhost2') } + it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_port').with_value('5673') } + it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_use_ssl').with_value('true') } + it { is_expected.to contain_glance_api_config('DEFAULT/kombu_ssl_ca_certs').with_ensure('absent') } + it { is_expected.to contain_glance_api_config('DEFAULT/kombu_ssl_certfile').with_ensure('absent') } + it { is_expected.to contain_glance_api_config('DEFAULT/kombu_ssl_keyfile').with_ensure('absent') } + it { is_expected.to contain_glance_api_config('DEFAULT/kombu_ssl_version').with_value('TLSv1') } + it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_durable_queues').with_value('true') } end end @@ -61,11 +61,11 @@ :kombu_ssl_version => 'TLSv1', } end - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value(true) } - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_ca_certs').with_value('/etc/ca.cert') } - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_value('/etc/certfile') } - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_value('/etc/key') } - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_version').with_value('TLSv1') } + it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_use_ssl').with_value(true) } + it { is_expected.to contain_glance_api_config('DEFAULT/kombu_ssl_ca_certs').with_value('/etc/ca.cert') } + it { is_expected.to contain_glance_api_config('DEFAULT/kombu_ssl_certfile').with_value('/etc/certfile') } + it { is_expected.to contain_glance_api_config('DEFAULT/kombu_ssl_keyfile').with_value('/etc/key') } + it { is_expected.to contain_glance_api_config('DEFAULT/kombu_ssl_version').with_value('TLSv1') } end describe 'with rabbit ssl disabled' do @@ -80,11 +80,11 @@ } end - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value('false') } - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_ca_certs').with_ensure('absent') } - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_ensure('absent') } - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_ensure('absent') } - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_version').with_ensure('absent') } + it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_use_ssl').with_value('false') } + it { is_expected.to contain_glance_api_config('DEFAULT/kombu_ssl_ca_certs').with_ensure('absent') } + it { is_expected.to contain_glance_api_config('DEFAULT/kombu_ssl_certfile').with_ensure('absent') } + it { is_expected.to contain_glance_api_config('DEFAULT/kombu_ssl_keyfile').with_ensure('absent') } + it { is_expected.to contain_glance_api_config('DEFAULT/kombu_ssl_version').with_ensure('absent') } end describe 'when passing params for single rabbit host' do @@ -98,11 +98,11 @@ :rabbit_durable_queues => true, } end - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_userid').with_value('guest2') } - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_host').with_value('localhost2') } - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_port').with_value('5673') } - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_hosts').with_value('localhost2:5673') } - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value('true') } + it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_userid').with_value('guest2') } + it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_host').with_value('localhost2') } + it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_port').with_value('5673') } + it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_hosts').with_value('localhost2:5673') } + it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_use_ssl').with_value('true') } it { is_expected.to contain_glance_api_config('DEFAULT/amqp_durable_queues').with_value('true') } end @@ -114,12 +114,12 @@ :rabbit_hosts => ['nonlocalhost3:5673', 'nonlocalhost4:5673'] } end - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_userid').with_value('guest3') } - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_hosts').with_value( + it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_userid').with_value('guest3') } + it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_hosts').with_value( 'nonlocalhost3:5673,nonlocalhost4:5673') } - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('true') } - it { is_expected.to_not contain_glance_api_config('oslo_messaging_rabbit/rabbit_port') } - it { is_expected.to_not contain_glance_api_config('oslo_messaging_rabbit/rabbit_host') } + it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_ha_queues').with_value('true') } + it { is_expected.to_not contain_glance_api_config('DEFAULT/rabbit_port') } + it { is_expected.to_not contain_glance_api_config('DEFAULT/rabbit_host') } end describe 'when using deprecated params' do diff --git a/glance/spec/classes/glance_registry_spec.rb b/glance/spec/classes/glance_registry_spec.rb index 2bb888ca2..615ffa2c0 100644 --- a/glance/spec/classes/glance_registry_spec.rb +++ b/glance/spec/classes/glance_registry_spec.rb @@ -83,7 +83,7 @@ 'refreshonly' => true, 'logoutput' => 'on_failure', 'subscribe' => ['Package[glance-registry]', 'File[/etc/glance/glance-registry.conf]'], - 'notify' => 'Service[glance-registry]' + 'notify' => ["Service[glance-registry]"] ) end end diff --git a/glance/spec/spec_helper_acceptance.rb b/glance/spec/spec_helper_acceptance.rb new file mode 100644 index 000000000..ea8ed6ef2 --- /dev/null +++ b/glance/spec/spec_helper_acceptance.rb @@ -0,0 +1,46 @@ +require 'beaker-rspec' + +hosts.each do |host| + + install_puppet + + on host, "mkdir -p #{host['distmoduledir']}" +end + +RSpec.configure do |c| + # Project root + proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) + + # Readable test descriptions + c.formatter = :documentation + + # Configure all nodes in nodeset + c.before :suite do + # Install module + hosts.each do |host| + + # install git + install_package host, 'git' + + # clean out any module cruft + shell('rm -fr /etc/puppet/modules/*') + + # install library modules from the forge + on host, puppet('module','install', '--force', 'puppetlabs-mysql', '--version', '3.2.0'), { :acceptable_exit_codes => [0,1] } + on host, puppet('module','install','dprince/qpid'), { :acceptable_exit_codes => [0,1] } + on host, puppet('module','install','puppetlabs-inifile'), { :acceptable_exit_codes => [0,1] } + on host, puppet('module','install','puppetlabs-stdlib'), { :acceptable_exit_codes => [0,1] } + on host, puppet('module','install','puppetlabs-rabbitmq'), { :acceptable_exit_codes => [0,1] } + on host, puppet('module','install','stahnma-epel'), { :acceptable_exit_codes => [0,1] } + + # install puppet modules from git, use master + shell('git clone https://git.openstack.org/stackforge/puppet-openstacklib /etc/puppet/modules/openstacklib') + shell('git clone https://git.openstack.org/stackforge/puppet-keystone /etc/puppet/modules/keystone') + + # Install the module being tested + puppet_module_install(:source => proj_root, :module_name => 'glance') + # List modules installed to help with debugging + on hosts[0], puppet('module','list'), { :acceptable_exit_codes => [0,1] } + end + end +end diff --git a/glance/spec/unit/provider/glance_spec.rb b/glance/spec/unit/provider/glance_spec.rb index 344ec4a21..14d418b97 100644 --- a/glance/spec/unit/provider/glance_spec.rb +++ b/glance/spec/unit/provider/glance_spec.rb @@ -36,7 +36,7 @@ 'admin_user' => 'user', 'admin_password' => 'pass' }, - 'glance_store' => + 'DEFAULT' => { 'os_region_name' => 'SomeRegion', }