From 86c008cca4a9ca5b3fed9f8231e23aa8250d32c7 Mon Sep 17 00:00:00 2001 From: Colleen Murphy Date: Fri, 13 Jul 2018 15:52:23 +0200 Subject: [PATCH] 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 --- spec/acceptance/fixtures/default.pp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/spec/acceptance/fixtures/default.pp b/spec/acceptance/fixtures/default.pp index 184675d..e262ab7 100644 --- a/spec/acceptance/fixtures/default.pp +++ b/spec/acceptance/fixtures/default.pp @@ -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'),