--- /dev/null
+require 'spec_helper_acceptance'
+
+describe 'ceilometer with mysql' do
+
+ context 'default parameters' do
+
+ it 'should work with no errors' do
+ pp= <<-EOS
+ Exec { logoutput => 'on_failure' }
+
+ # Common resources
+ 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 { 'ceilometer':
+ admin => true,
+ password => 'an_even_bigger_secret',
+ provider => 'rabbitmqctl',
+ require => Class['rabbitmq'],
+ }
+
+ rabbitmq_user_permissions { 'ceilometer@/':
+ configure_permission => '.*',
+ write_permission => '.*',
+ read_permission => '.*',
+ provider => 'rabbitmqctl',
+ require => Class['rabbitmq'],
+ }
+
+
+ # Keystone resources, needed by Ceilometer 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/",
+ }
+
+ # Ceilometer resources
+ class { '::ceilometer':
+ metering_secret => 'secrete',
+ rabbit_userid => 'ceilometer',
+ rabbit_password => 'an_even_bigger_secret',
+ rabbit_host => '127.0.0.1',
+ }
+ # Until https://review.openstack.org/177593 is merged:
+ Package<| title == 'python-mysqldb' |> -> Class['ceilometer::db']
+ class { '::ceilometer::db::mysql':
+ password => 'a_big_secret',
+ }
+ class { '::ceilometer::db':
+ database_connection => 'mysql://ceilometer:a_big_secret@127.0.0.1/ceilometer?charset=utf8',
+ }
+ class { '::ceilometer::keystone::auth':
+ password => 'a_big_secret',
+ }
+ class { '::ceilometer::client': }
+ class { '::ceilometer::collector': }
+ class { '::ceilometer::expirer': }
+ class { '::ceilometer::alarm::evaluator': }
+ class { '::ceilometer::alarm::notifier': }
+ class { '::ceilometer::agent::central': }
+ class { '::ceilometer::agent::notification': }
+ class { '::ceilometer::api':
+ enabled => true,
+ keystone_password => 'a_big_secret',
+ keystone_identity_uri => 'http://127.0.0.1:35357/',
+ }
+ EOS
+
+
+ # Run it twice and test for idempotency
+ apply_manifest(pp, :catch_failures => true)
+ apply_manifest(pp, :catch_changes => true)
+ end
+
+ describe port(8777) do
+ it { is_expected.to be_listening.with('tcp') }
+ end
+
+ describe cron do
+ it { should have_entry('1 0 * * * ceilometer-expirer').with_user('ceilometer') }
+ end
+
+ end
+end
--- /dev/null
+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 and dependencies
+ 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','puppetlabs-inifile'), { :acceptable_exit_codes => 0 }
+ on host, puppet('module','install','puppetlabs-mongodb'), { :acceptable_exit_codes => 0 }
+ 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','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')
+ 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 => 'ceilometer')
+ # List modules installed to help with debugging
+ on hosts[0], puppet('module','list'), { :acceptable_exit_codes => 0 }
+ end
+ end
+end