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 @@ +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 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 @@ +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 + + ServerName localhost + DocumentRoot /srv/static/status + Alias /reviews /srv/static/reviewday + + AllowOverride None + Order allow,deny + allow from all + = 2.4> + Require all granted + + + ErrorLog /var/log/apache2/status.openstack.org_error.log + LogLevel warn + CustomLog /var/log/apache2/status.openstack.org_access.log combined + ServerSignature Off +' +::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 => '', +}