diff --git a/spec/acceptance/basic_spec.rb b/spec/acceptance/basic_spec.rb new file mode 100755 index 0000000..d77fc3e --- /dev/null +++ b/spec/acceptance/basic_spec.rb @@ -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 diff --git a/spec/acceptance/fixtures/default.pp b/spec/acceptance/fixtures/default.pp new file mode 100644 index 0000000..c703ee6 --- /dev/null +++ b/spec/acceptance/fixtures/default.pp @@ -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'], +} diff --git a/spec/acceptance/fixtures/postconditions.pp b/spec/acceptance/fixtures/postconditions.pp new file mode 100644 index 0000000..a4337b9 --- /dev/null +++ b/spec/acceptance/fixtures/postconditions.pp @@ -0,0 +1,7 @@ +service { 'jenkins-log-client': + ensure => running, +} + +service { 'jenkins-log-worker-A': + ensure => running, +}