Make beaker tests work on xenial

Remove all spec assertions for the existence of files. We can assume
that if the puppet finished successfully then the config files were also
laid down correctly. We remove these checks instead of updating the test
for /home/gerrit/id_rsa.pub which was moved to
/home/gerrit/.ssh/id_rsa.pub.

Remove all spec assertions for the existence of packages. Again, we can
assume that if puppet finished successfully then the package was found
and installed. We remove these checks instead of updating the test for
the JRE package to point to the new Xenial package.

Don't set java_home in the gerrit class since the module should be
setting the right default for us based on the release.

Make mysql config changes prompt a service restart (only in the
fixture). gerrit::mysql sets sql-mode to remove NO_ZERO_DATE, but the
mysql module doesn't restart the service by default when the config
changes and bindep preinstalls mysql so the service is already started
when my.cnf is set.

Update the beaker nodeset and spec helper to run on xenial and install
puppet from the Ubuntu repos instead of from puppetlabs since puppetlabs
doesn't support puppet 3 on xenial.

Change-Id: I0b6db86a76fc532443f80d6cbed2b1ef6ca9605e
This commit is contained in:
Colleen Murphy 2017-06-10 22:26:25 +02:00
parent 0fdd0671c0
commit 61f6803f1e
4 changed files with 24 additions and 78 deletions

View File

@ -29,58 +29,6 @@ describe 'basic gerrit', :if => ['debian', 'ubuntu'].include?(os[:family]) do
apply_manifest(default_puppet_module, catch_changes: true)
end
describe 'required files and directories' do
describe file('/home/gerrit2/review_site/etc/gerrit.config') do
it { should be_file }
it { should contain('javaHome = /usr/lib/jvm/java-7-openjdk-amd64/jre') }
end
describe file('/home/gerrit2/review_site/etc/secure.config') do
it { should be_file }
it { should contain('password = 12345') }
end
describe file('/etc/default/gerritcodereview') do
it { should be_file }
it { should contain('GERRIT_SITE=/home/gerrit2/review_site') }
end
describe file('/etc/mysql/conf.d/client.conf') do
it { should be_file }
it { should contain('port = 3306') }
end
describe file('/home/gerrit2/review_site/etc/ssh_host_rsa_key') do
it { should be_file }
it { should contain('-----BEGIN RSA PRIVATE KEY-----') }
end
describe file('/home/gerrit2/review_site/etc/ssh_host_rsa_key.pub') do
it { should be_file }
it { should contain('ssh-rsa') }
end
describe file('/home/gerrit2/review_site/etc/ssh_project_rsa_key') do
it { should be_file }
it { should contain('-----BEGIN RSA PRIVATE KEY-----') }
end
describe file('/home/gerrit2/review_site/etc/ssh_project_rsa_key.pub') do
it { should be_file }
it { should contain('ssh-rsa') }
end
describe file('/home/gerrit2/.ssh/id_rsa') do
it { should be_file }
it { should contain('-----BEGIN RSA PRIVATE KEY-----') }
end
describe file('/home/gerrit2/id_rsa.pub') do
it { should be_file }
it { should contain('ssh-rsa') }
end
end
describe 'user' do
describe user('gerrit2') do
it { should exist }
@ -90,30 +38,6 @@ describe 'basic gerrit', :if => ['debian', 'ubuntu'].include?(os[:family]) do
end
end
describe 'required packages' do
installed_packages = [
'gitweb',
'unzip',
'openjdk-7-jre-headless',
'libmysql-java',
'mysql-client',
'mysql-server'
]
installed_packages.each do |package|
describe package(package) do
it { should be_installed }
end
end
unnecessary_packages = ['openjdk-6-jre-headless']
unnecessary_packages.each do |package|
describe package(package) do
it { should_not be_installed }
end
end
end
describe 'required services' do
describe port(80) do
it { should be_listening }

View File

@ -20,8 +20,13 @@ class { '::gerrit::mysql':
database_password => '12345',
}
# The mysql module doesn't restart the mysql service by default,
# and since mysql is preinstalled by bindep, the service is already
# started when the config is applied. This triggers a restart so that the
# sql-mode can be applied.
Class['::mysql::server::config'] ~> Class['::mysql::server::service']
class { '::gerrit':
java_home => '/usr/lib/jvm/java-7-openjdk-amd64/jre',
mysql_host => 'localhost',
mysql_password => '12345',
war => 'http://tarballs.openstack.org/ci/test/gerrit-v2.11.4.13.cb9800e.war',

View File

@ -0,0 +1,10 @@
HOSTS:
ubuntu-16.04-amd64:
roles:
- master
platform: ubuntu-16.04-amd64
hypervisor: none
ip: 127.0.0.1
CONFIG:
type: foss
set_env: false

View File

@ -2,7 +2,14 @@ require 'beaker-rspec'
hosts.each do |host|
install_puppet
# puppet 3 isn't available from apt.puppetlabs.com so install it from the Xenial repos
on host, "which apt-get && apt-get install puppet -y", { :acceptable_exit_codes => [0,1] }
# otherwise use the beaker helpers to install the yum.puppetlabs.com repo and puppet
r = on host, "which yum", { :acceptable_exit_codes => [0,1] }
if r.exit_code == 0
install_puppet
end
add_platform_foss_defaults(host, 'unix')
on host, "mkdir -p #{host['distmoduledir']}"