Fix beaker tests

On puppet 4, the tests were failing because the new ordering algorithm
caused the gerrit initializer exec resource to happen before the
database was set up. This patch adds an explicit ordering to the
gerrit::mysql class in the test fixtures to ensure the database is set
up first. This shouldn't be an issue in real life because we don't use
puppet to set up the database.

Also override the vhost_name and canonical server name parameters with
'localhost' since the $fqdn fact on test nodes can be wonky without some
extra setup.

Also add a conditional to the ssl-cert group exec so that it doesn't run
every time. Unfortunately this is not enough to make the tests
idempotent since the tidy resource behaves strangely when the directory
contains a symlink.

Change-Id: I56174d98496cd640b5b6490650a643c1aed740f7
This commit is contained in:
Colleen Murphy 2018-07-13 15:52:23 +02:00
parent ed2a3a85ae
commit 86c008cca4
1 changed files with 5 additions and 1 deletions

View File

@ -5,7 +5,8 @@ package { 'ssl-cert':
}
exec { 'ensure ssl-cert exists':
command => '/usr/sbin/groupadd -f ssl-cert'
command => '/usr/sbin/groupadd -f ssl-cert',
unless => '/bin/grep ssl-cert /etc/group',
}
# workaround since pip is not being installed as part of this module
@ -18,6 +19,7 @@ class { '::gerrit::mysql':
database_name => 'reviewdb',
database_user => 'gerrit2',
database_password => '12345',
before => Class['::gerrit'],
}
# The mysql module doesn't restart the mysql service by default,
@ -30,6 +32,8 @@ class { '::gerrit':
mysql_host => 'localhost',
mysql_password => '12345',
war => 'http://tarballs.openstack.org/ci/test/gerrit-v2.11.4.13.cb9800e.war',
vhost_name => 'localhost',
canonical_git_url => 'localhost',
ssh_rsa_key_contents => file('/tmp/gerrit-ssh-keys/ssh_rsa_key'),
ssh_rsa_pubkey_contents => file('/tmp/gerrit-ssh-keys/ssh_rsa_key.pub'),
ssh_project_rsa_key_contents => file('/tmp/gerrit-ssh-keys/ssh_project_rsa_key'),