Add beaker tests
Add tests to ensure the elastic_recheck classes work and that the service can start. This module hardcodes IRC bot configs, so the tests use resource overrides to set the bot channels to a test channel that's also used elsewhere in our tests to avoid spamming our real channels. In order for the bot to actually be functional it would need to have a real gerrit account, which we don't have, but this should still be sufficient as a test. Change-Id: I6da62d63d885037ecbc1560deec323e0d8583c3c
This commit is contained in:
parent
4b617e0229
commit
f0c649ba9d
32
spec/acceptance/basic_spec.rb
Executable file
32
spec/acceptance/basic_spec.rb
Executable file
@ -0,0 +1,32 @@
|
||||
require 'puppet-openstack_infra_spec_helper/spec_helper_acceptance'
|
||||
|
||||
describe 'elastic_recheck', 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
|
||||
|
||||
describe service('elastic-recheck') do
|
||||
it { should be_running }
|
||||
end
|
||||
|
||||
end
|
72
spec/acceptance/fixtures/default.pp
Normal file
72
spec/acceptance/fixtures/default.pp
Normal file
@ -0,0 +1,72 @@
|
||||
$gerrit_ssh_host_key = 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCfsIj/jqpI+2CFdjCL6kOiqdORWvxQ2sQbCzSzzmLXic8yVhCCbwarkvEpfUOHG4eyB0vqVZfMffxf0Yy3qjURrsroBCiuJ8GdiAcGdfYwHNfBI0cR6kydBZL537YDasIk0Z3ILzhwf7474LmkVzS7V2tMTb4ZiBS/jUeiHsVp88FZhIBkyhlb/awAGcUxT5U4QBXCAmerYXeB47FPuz9JFOVyF08LzH9JRe9tfXtqaCNhlSdRe/2pPRvn2EIhn5uHWwATACG9MBdrK8xv8LqPOik2w1JkgLWyBj11vDd5I3IjrmREGw8dqImqp0r6MD8rxqADlc1elfDIXYsy+TVH'
|
||||
|
||||
$recheck_ssh_public_key = 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCttDjvgwPrJwzo6QSeL1YSizIT3tnDoFV6RKwObA+SwTwsSB/G7RZ5wR7PcgXale0i2tK2n7cUsoegy8f3j1osUE0EkMUFJ0/i3hlj/BsrqS0zAOsoWq9yCiK3iT5wsHNzCmaQLzaA74UvAde0rUojNUD6PStuk5Xvew9MrNifYQ=='
|
||||
|
||||
$recheck_ssh_private_key = '-----BEGIN RSA PRIVATE KEY-----
|
||||
MIICXAIBAAKBgQCttDjvgwPrJwzo6QSeL1YSizIT3tnDoFV6RKwObA+SwTwsSB/G
|
||||
7RZ5wR7PcgXale0i2tK2n7cUsoegy8f3j1osUE0EkMUFJ0/i3hlj/BsrqS0zAOso
|
||||
Wq9yCiK3iT5wsHNzCmaQLzaA74UvAde0rUojNUD6PStuk5Xvew9MrNifYQIDAQAB
|
||||
AoGAOzFoGY5+/lpPVutZLIKbBTSz+vt9H+H6XvEZ5MxEPlFlLP3i/kn618DMvApy
|
||||
HjvrFG6XUa55mC8CcvQej6klI9bNe1fd/MQuqwz+okAglhx8YgL8CiJqM36FlyJk
|
||||
5w4FNb3GBOos8NJgIQpvYpj8VJqa0WV6ErllaBxuSC/8EMUCQQDd1mJHLBhw59El
|
||||
GHTP1VlSJjmy5gqyvc/uQwDDTlP3wcKqUBiLQLIveAdtrVowQYrxNRDCW/7EgIMB
|
||||
+VxecBjTAkEAyHQ/fDDM3eQeGz5z3qXsasiWV3nrxqM3hNmKF1XUFQwcWBzDl1Rs
|
||||
DSawZ4kgxMfJ2tjYUQLnFgabnyBc4SFGewJAYbuWlraVmgB3gvlQVVQwQuH2X5u7
|
||||
sN2xIs5AIst6cNfbdH9PIOKC3ijqVOafqkzl8rinRomTJ21ayl7a0/xc4wJAOODj
|
||||
crXWK9AiytA5yJ+EKfio0EGEKWT+x++CQ4TTHPXGxSnERhhqYIDt5TL/3VZjbHnD
|
||||
R5lvQMy3M7vXHvp2KQJBAMUZ5RcMpW5zASnUfkSUiV9NNFDlzd+Gp1l4JQ2VH4dy
|
||||
hSGUSarN2V7KnSzac4qGU3uQzMhnYu1QhzljfFc6D0I=
|
||||
-----END RSA PRIVATE KEY-----
|
||||
'
|
||||
|
||||
include elastic_recheck
|
||||
|
||||
$yaml_content = "channels:
|
||||
openstack-rainbow-unicorn-pals:
|
||||
projects:
|
||||
- all
|
||||
events:
|
||||
- positive
|
||||
- negative
|
||||
messages:
|
||||
# | means don't fold newlines, > means do
|
||||
found_bug: |
|
||||
I noticed Zuul failed, I think you hit bug(s):
|
||||
|
||||
%(bugs)s
|
||||
footer: >-
|
||||
For more details on this and other bugs, please see
|
||||
http://status.openstack.org/elastic-recheck/
|
||||
recheck_instructions: >-
|
||||
If you believe we've correctly identified the failure, feel free to leave a 'recheck'
|
||||
comment to run the tests again.
|
||||
unrecognized: >-
|
||||
Some of the tests failed in a way that we did not understand. Please help
|
||||
us classify these issues so that they can be part of Elastic Recheck
|
||||
http://status.openstack.org/elastic-recheck/
|
||||
no_bugs_found: >-
|
||||
I noticed Zuul failed, refer to:
|
||||
https://docs.openstack.org/infra/manual/developers.html#automated-testing
|
||||
"
|
||||
|
||||
# Override channel config file
|
||||
File <| title == '/etc/elastic-recheck/recheckwatchbot.yaml' |> {
|
||||
content => $yaml_content,
|
||||
source => undef,
|
||||
require => [
|
||||
File['/etc/elastic-recheck'],
|
||||
],
|
||||
before => Class['elastic_recheck::bot'],
|
||||
}
|
||||
|
||||
class { 'elastic_recheck::bot':
|
||||
gerrit_host => 'review.openstack.org',
|
||||
gerrit_ssh_host_key => $gerrit_ssh_host_key,
|
||||
recheck_ssh_public_key => $recheck_ssh_public_key,
|
||||
recheck_ssh_private_key => $recheck_ssh_private_key,
|
||||
recheck_bot_passwd => 'recheckbot',
|
||||
recheck_bot_nick => 'recheckbot',
|
||||
}
|
||||
|
||||
# sets up the cron update scripts for static pages
|
||||
include elastic_recheck::cron
|
Loading…
x
Reference in New Issue
Block a user