diff --git a/spec/acceptance/basic_spec.rb b/spec/acceptance/basic_spec.rb new file mode 100755 index 0000000..b3bdd8a --- /dev/null +++ b/spec/acceptance/basic_spec.rb @@ -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 diff --git a/spec/acceptance/fixtures/default.pp b/spec/acceptance/fixtures/default.pp new file mode 100644 index 0000000..15c2639 --- /dev/null +++ b/spec/acceptance/fixtures/default.pp @@ -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'], +}