From 3cba5197cc5c4e7807d5c97d374fb175b47878c7 Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Wed, 15 Apr 2015 21:30:59 -0400 Subject: [PATCH] Update Beaker tests Update beaker tests to cover more services & be more consistent with keystone & openstacklib. Change-Id: Id995ec7cd141aaeaea464781e3680ba4dcd94b42 Closes-bug: #1444736 --- spec/acceptance/basic_nova_spec.rb | 141 ++++++++++++++++++ spec/acceptance/class_spec.rb | 38 ----- spec/acceptance/nodesets/centos-70-x64.yml | 9 -- spec/acceptance/nodesets/default.yml | 9 ++ spec/acceptance/nodesets/nodepool.yml | 2 +- .../nodesets/ubuntu-server-1404-x64.yml | 11 -- spec/spec_helper_acceptance.rb | 15 +- 7 files changed, 159 insertions(+), 66 deletions(-) create mode 100644 spec/acceptance/basic_nova_spec.rb delete mode 100644 spec/acceptance/class_spec.rb delete mode 100644 spec/acceptance/nodesets/centos-70-x64.yml create mode 100644 spec/acceptance/nodesets/default.yml delete mode 100644 spec/acceptance/nodesets/ubuntu-server-1404-x64.yml diff --git a/spec/acceptance/basic_nova_spec.rb b/spec/acceptance/basic_nova_spec.rb new file mode 100644 index 000000000..f18dc51cc --- /dev/null +++ b/spec/acceptance/basic_nova_spec.rb @@ -0,0 +1,141 @@ +require 'spec_helper_acceptance' + +describe 'basic nova' do + + context 'default parameters' do + + it 'should work with no errors' do + pp= <<-EOS + Exec { logoutput => 'on_failure' } + + 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, + } ~> + exec { '/usr/bin/apt-get -y dist-upgrade': + refreshonly => true, + } + Apt::Source['trusty-updates-kilo'] -> Package<| |> + + class { '::mysql::server': } + + class { '::rabbitmq': + delete_guest_user => true, + erlang_cookie => 'secrete', + } + + rabbitmq_vhost { '/': + provider => 'rabbitmqctl', + require => Class['rabbitmq'], + } + + rabbitmq_user { 'nova': + admin => true, + password => 'an_even_bigger_secret', + provider => 'rabbitmqctl', + require => Class['rabbitmq'], + } + + rabbitmq_user_permissions { 'nova@/': + configure_permission => '.*', + write_permission => '.*', + read_permission => '.*', + provider => 'rabbitmqctl', + require => Class['rabbitmq'], + } + + # Keystone resources, needed by Nova to run + class { '::keystone::db::mysql': + 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/", + } + + # Nova resources + class { '::nova': + database_connection => 'mysql://nova:a_big_secret@127.0.0.1/nova?charset=utf8', + rabbit_userid => 'nova', + rabbit_password => 'an_even_bigger_secret', + image_service => 'nova.image.glance.GlanceImageService', + glance_api_servers => 'localhost:9292', + verbose => false, + rabbit_host => '127.0.0.1', + } + class { '::nova::db::mysql': + password => 'a_big_secret', + } + class { '::nova::keystone::auth': + password => 'a_big_secret', + } + class { '::nova::api': + enabled => true, + admin_password => 'a_big_secret', + identity_uri => 'http://127.0.0.1:35357/', + osapi_v3 => true, + } + class { '::nova::cert': enabled => true } + class { '::nova::client': } + class { '::nova::conductor': enabled => true } + class { '::nova::consoleauth': enabled => true } + class { '::nova::cron::archive_deleted_rows': } + class { '::nova::compute': + enabled => true, + vnc_enabled => true, + } + class { '::nova::compute::libvirt': + migration_support => true, + vncserver_listen => '0.0.0.0', + } + class { '::nova::scheduler': enabled => true } + class { '::nova::vncproxy': enabled => true } + # TODO: networking with neutron + EOS + + + # Run it twice and test for idempotency + apply_manifest(pp, :catch_failures => true) + apply_manifest(pp, :catch_changes => true) + end + + describe port(8773) do + it { is_expected.to be_listening.with('tcp') } + end + + describe port(8774) do + it { is_expected.to be_listening.with('tcp') } + end + + describe port(8775) do + it { is_expected.to be_listening.with('tcp') } + end + + describe port(6080) do + it { is_expected.to be_listening.with('tcp') } + end + + describe cron do + it { should have_entry('1 0 * * * nova-manage db archive_deleted_rows --max_rows 100 >>/var/log/nova/nova-rowsflush.log 2>&1').with_user('nova') } + end + + end +end diff --git a/spec/acceptance/class_spec.rb b/spec/acceptance/class_spec.rb deleted file mode 100644 index 629578e60..000000000 --- a/spec/acceptance/class_spec.rb +++ /dev/null @@ -1,38 +0,0 @@ -require 'spec_helper_acceptance' - -describe 'nova class' do - - context 'default parameters' do - - it 'should work with no errors' do - pp= <<-EOS - include epel # Get our epel on - class { 'nova': - database_connection => 'mysql://nova:a_big_secret@127.0.0.1/nova?charset=utf8', - rabbit_userid => 'nova', - rabbit_password => 'an_even_bigger_secret', - image_service => 'nova.image.glance.GlanceImageService', - glance_api_servers => 'localhost:9292', - verbose => false, - rabbit_host => '127.0.0.1', - } - - class { 'nova::compute': - enabled => true, - vnc_enabled => true, - } - - class { 'nova::compute::libvirt': - migration_support => true, - vncserver_listen => '0.0.0.0', - } - 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/spec/acceptance/nodesets/centos-70-x64.yml b/spec/acceptance/nodesets/centos-70-x64.yml deleted file mode 100644 index 254f63831..000000000 --- a/spec/acceptance/nodesets/centos-70-x64.yml +++ /dev/null @@ -1,9 +0,0 @@ -HOSTS: - centos-70-x64: - roles: - - master - platform: el-7-x86_64 - box : puppetlabs/centos-7.0-64-puppet - hypervisor : vagrant -CONFIG: - type: foss diff --git a/spec/acceptance/nodesets/default.yml b/spec/acceptance/nodesets/default.yml new file mode 100644 index 000000000..a2c1ecc63 --- /dev/null +++ b/spec/acceptance/nodesets/default.yml @@ -0,0 +1,9 @@ +HOSTS: + ubuntu-14.04-amd64: + roles: + - master + platform: ubuntu-14.04-amd64 + hypervisor : none + ip: 127.0.0.1 +CONFIG: + type: foss diff --git a/spec/acceptance/nodesets/nodepool.yml b/spec/acceptance/nodesets/nodepool.yml index 757ba9851..a2c1ecc63 100644 --- a/spec/acceptance/nodesets/nodepool.yml +++ b/spec/acceptance/nodesets/nodepool.yml @@ -1,5 +1,5 @@ HOSTS: - ubuntu-server-1404-x64: + ubuntu-14.04-amd64: roles: - master platform: ubuntu-14.04-amd64 diff --git a/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml b/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml deleted file mode 100644 index 4cb4ad430..000000000 --- a/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml +++ /dev/null @@ -1,11 +0,0 @@ -HOSTS: - ubuntu-server-1404-x64: - roles: - - master - platform: ubuntu-14.04-amd64 - box : trusty-server-cloudimg-amd64-vagrant-disk1 - box_url : https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box - hypervisor : vagrant -CONFIG: - log_level : debug - type: git diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 36363ae04..d8b6c669e 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -16,6 +16,7 @@ RSpec.configure do |c| # Configure all nodes in nodeset c.before :suite do + # Install module and dependencies hosts.each do |host| # install git @@ -25,12 +26,12 @@ RSpec.configure do |c| shell('rm -fr /etc/puppet/modules/*') # install library modules from the forge - on host, puppet('module','install', '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','duritong/sysctl'), { :acceptable_exit_codes => [0,1] } - on host, puppet('module','install','puppetlabs-inifile'), { :acceptable_exit_codes => [0,1] } - on host, puppet('module','install','stahnma-epel'), { :acceptable_exit_codes => [0,1] } - on host, puppet('module','install','puppetlabs-rabbitmq'), { :acceptable_exit_codes => [0,1] } + on host, puppet('module','install','puppetlabs-mysql'), { :acceptable_exit_codes => 0 } + on host, puppet('module','install','dprince/qpid'), { :acceptable_exit_codes => 0 } + on host, puppet('module','install','duritong/sysctl'), { :acceptable_exit_codes => 0 } + on host, puppet('module','install','puppetlabs-inifile'), { :acceptable_exit_codes => 0 } + on host, puppet('module','install','stahnma-epel'), { :acceptable_exit_codes => 0 } + on host, puppet('module','install','puppetlabs-rabbitmq'), { :acceptable_exit_codes => 0 } # install puppet modules from git, use master shell('git clone https://git.openstack.org/stackforge/puppet-openstacklib /etc/puppet/modules/openstacklib') @@ -41,7 +42,7 @@ RSpec.configure do |c| # Install the module being tested puppet_module_install(:source => proj_root, :module_name => 'nova') # List modules installed to help with debugging - on hosts[0], puppet('module','list'), { :acceptable_exit_codes => [0,1] } + on hosts[0], puppet('module','list'), { :acceptable_exit_codes => 0 } end end end