Add beaker tests

Add basic tests to ensure the puppet class applies cleanly and the
service can start.

Change-Id: I091d1cd7b4a00f1ef3c955ab330d24cd066818a6
This commit is contained in:
Colleen Murphy 2018-07-11 13:27:15 +02:00
parent c3c944a975
commit 36bf78f1d1
2 changed files with 59 additions and 0 deletions

27
spec/acceptance/basic_spec.rb Executable file
View File

@ -0,0 +1,27 @@
require 'puppet-openstack_infra_spec_helper/spec_helper_acceptance'
describe 'gerritbot' 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
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
describe service('gerritbot') do
it { should be_running }
end
end

View File

@ -0,0 +1,32 @@
$gerritbot_ssh_rsa_pubkey_contents = 'ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFnYsbHrGl99in5doo1uy+V3N3ayR4J0/sJprK+7E8exDwAGe1vZmUftjZ6uMi4RckxuFTuVJdxrFvTLEQpNrSU='
$gerritbot_ssh_rsa_key_contents = 'MHcCAQEEIJUIOR4hPwqds8ESewPHm+r5ejSqjuFjBfVa7jQTH99QoAoGCCqGSM49
AwEHoUQDQgAEWdixsesaX32Kfl2ijW7L5Xc3drJHgnT+wmmsr7sTx7EPAAZ7W9mZ
R+2Nnq4yLhFyTG4VO5Ul3GsW9MsRCk2tJQ==
-----END EC PRIVATE KEY-----'
file { '/etc/gerritbot-channels.yaml':
ensure => present,
content => '',
}
include gerrit::user
file { '/home/gerrit2/.ssh':
ensure => directory,
owner => 'gerrit2',
mode => '0700',
require => User['gerrit2'],
}
class { 'gerritbot':
nick => 'openstackgerrit',
password => 'gerritbot_password',
server => 'irc.freenode.net',
user => 'gerritbot',
vhost_name => 'review.openstack.org',
ssh_rsa_key_contents => $gerritbot_ssh_rsa_key_contents,
ssh_rsa_pubkey_contents => $gerritbot_ssh_rsa_pubkey_contents,
channel_file => '/etc/gerritbot-channels.yaml',
require => File['/etc/gerritbot-channels.yaml',
}