From 70438d9ce705292aa5fce336ba77e6dcdbb19de3 Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Thu, 2 Feb 2017 11:46:23 -0500 Subject: [PATCH] acceptance: add first beaker tests Add first acceptance tests for Beaker. Depends-On: If47aa7b368fe306d339d89a010f4ffa67402dd03 Change-Id: Ia22a5110a85294bf0585262feac9c096cc8a1dbc --- manifests/db/sync.pp | 4 +- spec/acceptance/tacker_spec.rb | 74 +++++++++++++++++++++++++++++ spec/classes/tacker_db_sync_spec.rb | 2 +- 3 files changed, 77 insertions(+), 3 deletions(-) create mode 100644 spec/acceptance/tacker_spec.rb diff --git a/manifests/db/sync.pp b/manifests/db/sync.pp index 9c2732d..a893af6 100644 --- a/manifests/db/sync.pp +++ b/manifests/db/sync.pp @@ -6,14 +6,14 @@ # [*extra_params*] # (optional) String of extra command line parameters to append # to the tacker-dbsync command. -# Defaults to undef +# Defaults to '--config-file /etc/tacker/tacker.conf' # # [*user*] # (optional) User to run dbsync command. # Defaults to 'congress' # class tacker::db::sync( - $extra_params = undef, + $extra_params = '--config-file /etc/tacker/tacker.conf', $user = 'tacker', ) { diff --git a/spec/acceptance/tacker_spec.rb b/spec/acceptance/tacker_spec.rb new file mode 100644 index 0000000..23b852d --- /dev/null +++ b/spec/acceptance/tacker_spec.rb @@ -0,0 +1,74 @@ +require 'spec_helper_acceptance' + +describe 'basic tacker' do + + context 'default parameters' do + + it 'should work with no errors' do + pp= <<-EOS + include ::openstack_integration + include ::openstack_integration::repos + include ::openstack_integration::rabbitmq + include ::openstack_integration::mysql + include ::openstack_integration::keystone + + rabbitmq_user { 'tacker': + admin => true, + password => 'my_secret', + provider => 'rabbitmqctl', + require => Class['rabbitmq'], + } + + rabbitmq_user_permissions { 'tacker@/': + configure_permission => '.*', + write_permission => '.*', + read_permission => '.*', + provider => 'rabbitmqctl', + require => Class['rabbitmq'], + } + + class { '::tacker::db::mysql': + password => 'a_big_secret', + } + case $::osfamily { + 'Debian': { + warning('Gnocchi is not yet packaged on Ubuntu systems.') + } + 'RedHat': { + class { '::tacker::db': + database_connection => 'mysql+pymysql://tacker:a_big_secret@127.0.0.1/tacker?charset=utf8', + } + class { '::tacker::keystone::auth': + password => 'a_big_secret', + } + class { '::tacker::keystone::authtoken': + password => 'a_big_secret', + } + class { '::tacker::logging': + debug => true, + } + class { '::tacker': + default_transport_url => 'rabbit://tacker:my_secret@127.0.0.1:5672/', + } + include ::tacker::server + include ::tacker::client + } + default: { + fail("Unsupported osfamily (${::osfamily})") + } + } + EOS + + # Run it twice and test for idempotency + apply_manifest(pp, :catch_failures => true) + apply_manifest(pp, :catch_changes => true) + end + + if os[:family].casecmp('RedHat') == 0 + describe port(9890) do + it { is_expected.to be_listening } + end + end + end + +end diff --git a/spec/classes/tacker_db_sync_spec.rb b/spec/classes/tacker_db_sync_spec.rb index e744a80..89a2922 100644 --- a/spec/classes/tacker_db_sync_spec.rb +++ b/spec/classes/tacker_db_sync_spec.rb @@ -6,7 +6,7 @@ describe 'tacker::db::sync' do it 'runs tacker-manage db sync' do is_expected.to contain_exec('tacker-db-sync').with( - :command => 'tacker-db-manage upgrade head', + :command => 'tacker-db-manage --config-file /etc/tacker/tacker.conf upgrade head', :user => 'tacker', :path => ['/bin','/usr/bin'], :refreshonly => 'true',