Add beaker tests
Add basic tests to ensure the classes can apply cleanly and the services start. Change-Id: I51033cee31c58c8e5a4b1b16c731844c8e26ef46
This commit is contained in:
parent
c646602e20
commit
6d20f37d26
38
spec/acceptance/basic_spec.rb
Executable file
38
spec/acceptance/basic_spec.rb
Executable file
@ -0,0 +1,38 @@
|
||||
require 'puppet-openstack_infra_spec_helper/spec_helper_acceptance'
|
||||
|
||||
describe 'log_processor', if: os[:family] == 'ubuntu' 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
|
||||
|
||||
['jenkins-log-client', 'jenkins-log-worker-A'].each do |service|
|
||||
describe service(service) do
|
||||
it { should be_running }
|
||||
end
|
||||
end
|
||||
|
||||
end
|
49
spec/acceptance/fixtures/default.pp
Normal file
49
spec/acceptance/fixtures/default.pp
Normal file
@ -0,0 +1,49 @@
|
||||
$worker_config = 'gearman-host: localhost
|
||||
gearman-port: 4730
|
||||
output-host: localhost
|
||||
output-port: 9999
|
||||
output-mode: tcp
|
||||
crm114-script: /usr/local/bin/classify-log.crm
|
||||
crm114-data: /var/lib/crm114
|
||||
mqtt-host: firehose.openstack.org
|
||||
mqtt-port: 8883
|
||||
mqtt-topic: gearman-logstash/localhost
|
||||
mqtt-user: infra
|
||||
mqtt-pass: mqtt_password
|
||||
mqtt-ca-certs: /etc/logstash/mqtt-root-CA.pem.crt'
|
||||
|
||||
$client_config = 'source-url: http://localhost
|
||||
zmq-publishers: []
|
||||
subunit-files:
|
||||
- name: logs/testrepository.subunit
|
||||
build-queue-filter: gate
|
||||
source-files:
|
||||
- name: console.html
|
||||
tags:
|
||||
- console'
|
||||
|
||||
file { '/tmp/jenkins-log-client.yaml':
|
||||
ensure => present,
|
||||
content => $client_config,
|
||||
}
|
||||
|
||||
file { '/etc/logprocessor/worker.yaml':
|
||||
ensure => present,
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0644',
|
||||
content => $worker_config,
|
||||
require => Class['::log_processor'],
|
||||
}
|
||||
|
||||
class { 'log_processor': }
|
||||
|
||||
class { 'log_processor::client':
|
||||
config_file => '/tmp/jenkins-log-client.yaml',
|
||||
statsd_host => 'graphite.openstack.org',
|
||||
}
|
||||
|
||||
log_processor::worker { 'A':
|
||||
config_file => '/etc/logprocessor/worker.yaml',
|
||||
require => File['/etc/logprocessor/worker.yaml'],
|
||||
}
|
7
spec/acceptance/fixtures/postconditions.pp
Normal file
7
spec/acceptance/fixtures/postconditions.pp
Normal file
@ -0,0 +1,7 @@
|
||||
service { 'jenkins-log-client':
|
||||
ensure => running,
|
||||
}
|
||||
|
||||
service { 'jenkins-log-worker-A':
|
||||
ensure => running,
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user