Add beaker tests

Add basic tests to ensure the manifests can be applied cleanly and the
site comes up.

Change-Id: Id477b53849f6efd9715f89ca54eaa899fe08c90f
This commit is contained in:
Colleen Murphy 2018-07-11 23:00:35 +02:00
parent 3d9839bfa4
commit 3a042122ec
2 changed files with 83 additions and 0 deletions

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

@ -0,0 +1,31 @@
require 'puppet-openstack_infra_spec_helper/spec_helper_acceptance'
describe 'reviewday', 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
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 command('su - reviewday -c "cd /var/lib/reviewday/reviewday/ && PYTHONPATH=/var/lib/reviewday/reviewday flock -n /var/lib/reviewday/update.lock python bin/reviewday -o /srv/static/reviewday"') do
its(:exit_status) { should eq 0 }
end
describe command('curl http://localhost/reviews/') do
its(:stdout) { should contain('OpenStack branch reviews') }
end
end

View File

@ -0,0 +1,52 @@
include pip
include reviewday
include httpd
file { '/srv/static':
ensure => directory,
}
file { '/srv/static/status':
ensure => directory,
require => File['/srv/static'],
}
$status_vhost = 'NameVirtualHost *:80
<VirtualHost *:80>
ServerName localhost
DocumentRoot /srv/static/status
Alias /reviews /srv/static/reviewday
<Directory /srv/static/reviewday>
AllowOverride None
Order allow,deny
allow from all
<IfVersion >= 2.4>
Require all granted
</IfVersion>
</Directory>
ErrorLog /var/log/apache2/status.openstack.org_error.log
LogLevel warn
CustomLog /var/log/apache2/status.openstack.org_access.log combined
ServerSignature Off
</VirtualHost>'
::httpd::vhost { 'status.openstack.org':
port => 80,
priority => '50',
docroot => '/srv/static/status',
content => $status_vhost,
require => File['/srv/static/status'],
}
reviewday::site { 'reviewday':
git_url => 'git://git.openstack.org/openstack-infra/reviewday',
serveradmin => 'webmaster@openstack.org',
httproot => '/srv/static/reviewday',
gerrit_url => 'review.openstack.org',
gerrit_port => '29418',
gerrit_user => 'reviewday',
reviewday_gerrit_ssh_key => '',
reviewday_rsa_pubkey_contents => '',
reviewday_rsa_key_contents => '',
}