summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColleen Murphy <colleen.murphy@suse.de>2018-07-11 23:00:35 +0200
committerColleen Murphy <colleen.murphy@suse.de>2018-07-12 11:34:11 +0200
commit3a042122ec2cfdbec9376ad9a3ef7603a5df4d33 (patch)
tree2f7c10b382df20e055ea3b3b4f62cbadcfd24a5d
parent3d9839bfa4bf39cfef4e81697df35196001049e1 (diff)
Add beaker tests
Add basic tests to ensure the manifests can be applied cleanly and the site comes up. Change-Id: Id477b53849f6efd9715f89ca54eaa899fe08c90f
Notes
Notes (review): Code-Review+2: Monty Taylor <mordred@inaugust.com> Code-Review+2: Clark Boylan <cboylan@sapwetik.org> Workflow+1: Clark Boylan <cboylan@sapwetik.org> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Wed, 01 Aug 2018 23:16:08 +0000 Reviewed-on: https://review.openstack.org/581885 Project: openstack-infra/puppet-reviewday Branch: refs/heads/master
-rwxr-xr-xspec/acceptance/basic_spec.rb31
-rw-r--r--spec/acceptance/fixtures/default.pp52
2 files changed, 83 insertions, 0 deletions
diff --git a/spec/acceptance/basic_spec.rb b/spec/acceptance/basic_spec.rb
new file mode 100755
index 0000000..cd151b1
--- /dev/null
+++ b/spec/acceptance/basic_spec.rb
@@ -0,0 +1,31 @@
1require 'puppet-openstack_infra_spec_helper/spec_helper_acceptance'
2
3describe 'reviewday', if: os[:family] == 'ubuntu' do
4
5 def pp_path
6 base_path = File.dirname(__FILE__)
7 File.join(base_path, 'fixtures')
8 end
9
10 def puppet_manifest
11 manifest_path = File.join(pp_path, 'default.pp')
12 File.read(manifest_path)
13 end
14
15 it 'should work with no errors' do
16 apply_manifest(puppet_manifest, catch_failures: true)
17 end
18
19 it 'should be idempotent' do
20 apply_manifest(puppet_manifest, catch_changes: true)
21 end
22
23 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
24 its(:exit_status) { should eq 0 }
25 end
26
27 describe command('curl http://localhost/reviews/') do
28 its(:stdout) { should contain('OpenStack branch reviews') }
29 end
30
31end
diff --git a/spec/acceptance/fixtures/default.pp b/spec/acceptance/fixtures/default.pp
new file mode 100644
index 0000000..8abd87f
--- /dev/null
+++ b/spec/acceptance/fixtures/default.pp
@@ -0,0 +1,52 @@
1include pip
2
3include reviewday
4
5include httpd
6
7file { '/srv/static':
8 ensure => directory,
9}
10
11file { '/srv/static/status':
12 ensure => directory,
13 require => File['/srv/static'],
14}
15
16$status_vhost = 'NameVirtualHost *:80
17<VirtualHost *:80>
18 ServerName localhost
19 DocumentRoot /srv/static/status
20 Alias /reviews /srv/static/reviewday
21 <Directory /srv/static/reviewday>
22 AllowOverride None
23 Order allow,deny
24 allow from all
25 <IfVersion >= 2.4>
26 Require all granted
27 </IfVersion>
28 </Directory>
29 ErrorLog /var/log/apache2/status.openstack.org_error.log
30 LogLevel warn
31 CustomLog /var/log/apache2/status.openstack.org_access.log combined
32 ServerSignature Off
33</VirtualHost>'
34::httpd::vhost { 'status.openstack.org':
35 port => 80,
36 priority => '50',
37 docroot => '/srv/static/status',
38 content => $status_vhost,
39 require => File['/srv/static/status'],
40}
41
42reviewday::site { 'reviewday':
43 git_url => 'git://git.openstack.org/openstack-infra/reviewday',
44 serveradmin => 'webmaster@openstack.org',
45 httproot => '/srv/static/reviewday',
46 gerrit_url => 'review.openstack.org',
47 gerrit_port => '29418',
48 gerrit_user => 'reviewday',
49 reviewday_gerrit_ssh_key => '',
50 reviewday_rsa_pubkey_contents => '',
51 reviewday_rsa_key_contents => '',
52}