Add beaker check of vhost template

A subsequent patch will change how the the cgit apache vhost will be
defined, so add tests now to ensure that the future change produces
identical config files.

Change-Id: Ib8c1c3c63b52a6ea90bf25222fe0dba6936409da
This commit is contained in:
Colleen Murphy 2018-05-29 10:56:39 -07:00
parent a44b818c21
commit 74019b2d87
2 changed files with 134 additions and 0 deletions

View File

@ -193,6 +193,73 @@ describe 'puppet-cgit module', :if => ['fedora', 'redhat'].include?(os[:family])
it { should be_grouped_into 'root' }
its(:content) { should include 'Listen 443' }
end
vhost_content = '<VirtualHost *:80>
ServerName localhost
ServerAdmin webmaster@localhost
Alias /cgit-data /usr/share/cgit
ScriptAlias /cgit /var/www/cgi-bin/cgit
Alias /static /var/www/cgit/static
RewriteEngine On
RewriteRule ^/$ /cgit [R]
SetEnv GIT_PROJECT_ROOT /var/lib/git
SetEnv GIT_HTTP_EXPORT_ALL
SetEnv GIT_NOTES_DISPLAY_REF refs/notes/*
SetEnv CGIT_CONFIG /etc/cgitrc
AliasMatch ^/(.*/objects/[0-9a-f]{2}/[0-9a-f]{38})$ /var/lib/git/$1
AliasMatch ^/(.*/objects/pack/pack-[0-9a-f]{40}.(pack|idx))$ /var/lib/git/$1
ScriptAlias / /usr/libexec/git-core/git-http-backend/
ErrorLog /var/log/httpd/localhost-error.log
LogLevel warn
CustomLog /var/log/httpd/localhost-access.log combined
</VirtualHost>
<VirtualHost *:443>
ServerName localhost
ServerAdmin webmaster@localhost
Alias /cgit-data /usr/share/cgit
ScriptAlias /cgit /var/www/cgi-bin/cgit
Alias /static /var/www/cgit/static
RewriteEngine On
RewriteRule ^/$ /cgit [R]
SetEnv GIT_PROJECT_ROOT /var/lib/git
SetEnv GIT_HTTP_EXPORT_ALL
SetEnv GIT_NOTES_DISPLAY_REF refs/notes/*
SetEnv CGIT_CONFIG /etc/cgitrc
AliasMatch ^/(.*/objects/[0-9a-f]{2}/[0-9a-f]{38})$ /var/lib/git/$1
AliasMatch ^/(.*/objects/pack/pack-[0-9a-f]{40}.(pack|idx))$ /var/lib/git/$1
ScriptAlias / /usr/libexec/git-core/git-http-backend/
ErrorLog /var/log/httpd/localhost-ssl-error.log
LogLevel warn
CustomLog /var/log/httpd/localhost-ssl-access.log combined
SSLEngine on
SSLProtocol All -SSLv2 -SSLv3
SSLCertificateFile /etc/pki/tls/certs/localhost.pem
SSLCertificateKeyFile /etc/pki/tls/private/localhost.key
</VirtualHost>
'
describe file('/etc/httpd/conf.d/25-localhost.conf') do
its(:content) { should eq vhost_content }
end
end
describe 'selinux' do

View File

@ -190,6 +190,73 @@ describe 'puppet-cgit module begind proxy', :if => ['fedora', 'redhat'].include?
it { should be_grouped_into 'root' }
its(:content) { should include 'Listen 4443' }
end
vhost_content = '<VirtualHost *:8080>
ServerName localhost
ServerAdmin webmaster@localhost
Alias /cgit-data /usr/share/cgit
ScriptAlias /cgit /var/www/cgi-bin/cgit
Alias /static /var/www/cgit/static
RewriteEngine On
RewriteRule ^/$ /cgit [R]
SetEnv GIT_PROJECT_ROOT /var/lib/git
SetEnv GIT_HTTP_EXPORT_ALL
SetEnv GIT_NOTES_DISPLAY_REF refs/notes/*
SetEnv CGIT_CONFIG /etc/cgitrc
AliasMatch ^/(.*/objects/[0-9a-f]{2}/[0-9a-f]{38})$ /var/lib/git/$1
AliasMatch ^/(.*/objects/pack/pack-[0-9a-f]{40}.(pack|idx))$ /var/lib/git/$1
ScriptAlias / /usr/libexec/git-core/git-http-backend/
ErrorLog /var/log/httpd/localhost-error.log
LogLevel warn
CustomLog /var/log/httpd/localhost-access.log combined
</VirtualHost>
<VirtualHost *:4443>
ServerName localhost
ServerAdmin webmaster@localhost
Alias /cgit-data /usr/share/cgit
ScriptAlias /cgit /var/www/cgi-bin/cgit
Alias /static /var/www/cgit/static
RewriteEngine On
RewriteRule ^/$ /cgit [R]
SetEnv GIT_PROJECT_ROOT /var/lib/git
SetEnv GIT_HTTP_EXPORT_ALL
SetEnv GIT_NOTES_DISPLAY_REF refs/notes/*
SetEnv CGIT_CONFIG /etc/cgitrc
AliasMatch ^/(.*/objects/[0-9a-f]{2}/[0-9a-f]{38})$ /var/lib/git/$1
AliasMatch ^/(.*/objects/pack/pack-[0-9a-f]{40}.(pack|idx))$ /var/lib/git/$1
ScriptAlias / /usr/libexec/git-core/git-http-backend/
ErrorLog /var/log/httpd/localhost-ssl-error.log
LogLevel warn
CustomLog /var/log/httpd/localhost-ssl-access.log combined
SSLEngine on
SSLProtocol All -SSLv2 -SSLv3
SSLCertificateFile /etc/pki/tls/certs/localhost.pem
SSLCertificateKeyFile /etc/pki/tls/private/localhost.key
</VirtualHost>
'
describe file('/etc/httpd/conf.d/25-localhost.conf') do
its(:content) { should eq vhost_content }
end
end
describe 'selinux' do