Add beaker tests

Add tests to ensure the subunit2sql server and worker classes work and
that the worker service can start.

Change-Id: I842ecbcd5988484043643fdae1c49dd95bba90f2
This commit is contained in:
Colleen Murphy 2018-07-09 18:30:00 +02:00 committed by Colleen Murphy
parent 8360c894db
commit f5d762f98e
3 changed files with 69 additions and 0 deletions

View File

@ -0,0 +1,36 @@
require 'puppet-openstack_infra_spec_helper/spec_helper_acceptance'
describe 'subunit2sql', :if => ['debian', 'ubuntu'].include?(os[:family]) do
def pp_path
base_path = File.dirname(__FILE__)
File.join(base_path, 'fixtures')
end
def puppet_manifest
manifest_path = File.join(pp_path, 'default.pp')
File.read(manifest_path)
end
def postconditions_puppet_manifest
manifest_path = File.join(pp_path, 'postconditions.pp')
File.read(manifest_path)
end
it 'should work with no errors' do
apply_manifest(puppet_manifest, catch_failures: true)
end
it 'should be idempotent' do
apply_manifest(puppet_manifest, catch_changes: true)
end
it 'should start' do
apply_manifest(postconditions_puppet_manifest, catch_failures: true)
end
describe service('jenkins-subunit-worker-A') do
it { should be_running }
end
end

View File

@ -0,0 +1,30 @@
$content = "gearman-host: logstash.openstack.org
gearman-port: 4730
config: /etc/subunit2sql/subunit2sql.conf
mqtt-host: firehose.openstack.org
mqtt-port: 8883
mqtt-topic: gearman-subunit/localhost
mqtt-user: 'mqtt_user'
mqtt-pass: 'mqtt_pass'
mqtt-ca-certs: /etc/subunit2sql/mqtt-root-CA.pem.crt"
file { '/etc/subunit2sql/subunit-woker.yaml':
ensure => file,
owner => 'root',
group => 'root',
mode => '0555',
content => $content,
}
include 'subunit2sql'
class { 'subunit2sql::server':
db_host => 'subunit2sql_db_host',
db_pass => 'subunit2sql_db_pass',
}
subunit2sql::worker { 'A':
config_file => '/etc/subunit2sql/subunit-woker.yaml',
db_host => $subunit2sql_db_host,
db_pass => $subunit2sql_db_pass,
}

View File

@ -0,0 +1,3 @@
service { 'jenkins-subunit-worker-A':
ensure => running,
}