Browse Source

Add beaker tests

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

Change-Id: Id477b53849f6efd9715f89ca54eaa899fe08c90f
master
Colleen Murphy 10 months ago
parent
commit
3a042122ec
2 changed files with 83 additions and 0 deletions
  1. 31
    0
      spec/acceptance/basic_spec.rb
  2. 52
    0
      spec/acceptance/fixtures/default.pp

+ 31
- 0
spec/acceptance/basic_spec.rb View File

@@ -0,0 +1,31 @@
1
+require 'puppet-openstack_infra_spec_helper/spec_helper_acceptance'
2
+
3
+describe '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
+
31
+end

+ 52
- 0
spec/acceptance/fixtures/default.pp View File

@@ -0,0 +1,52 @@
1
+include pip
2
+
3
+include reviewday
4
+
5
+include httpd
6
+
7
+file { '/srv/static':
8
+  ensure => directory,
9
+}
10
+
11
+file { '/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
+
42
+reviewday::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
+}

Loading…
Cancel
Save