Skip to content

Commit 5a6bed0

Browse files
committed
(gh-19) Track pdb integration in acceptance suite
Because some older platforms may not have postgresql packages, we may not be able to setup openvoxdb for testing alongside openvox-server, and the pre-suite step 95_install_pdb skips if postgresql is not available. Two later tests, 00_smoke/puppetdb_integration and catalog/v4_catalog are affected by this. The former made the same test as 95_install_pdb to determine whether to skip, and the later just checked for existence of pdb configuration files as evidence it should execute with pdb integration. This would work because the install_pdb step formerly gated withether a pdb package was installed at all. Since the suite now expects to be able to run with openvoxdb installed before Beaker executes, I'm changing how this works. The pre-suite/foss/95_install_pdb still gates whether pdb is configured based on postgresql gems, but now marks a class instance variable to indicate that pdb integration should be expected by later tests. Both the puppetdb_integration and the v4_catalog tests now use the test_with_pdb? method to check whether they should skip/run with pdb integration.
1 parent be39892 commit 5a6bed0

4 files changed

Lines changed: 27 additions & 9 deletions

File tree

acceptance/lib/helper.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,23 @@ def unsupported_postgresql_platform?(host)
7171

7272
class << self
7373
attr_reader :config
74+
# Flag to indicate whether tests should expect to be able to
75+
# interoperate with an openvoxdb instance.
76+
attr_accessor :pdb_integration_expected
77+
end
78+
79+
# Set in pre_suite/foss/95_install_pdb.rb if the platform
80+
# has postgresql available. After this, other tests
81+
# can check test_with_pdb?() to determine if they should
82+
# skip or test pdb related functionality.
83+
def mark_pdb_integration_expected
84+
PuppetServerExtensions.pdb_integration_expected = true
85+
end
86+
87+
# Returns true if the tests should expect to be able to
88+
# interoperate with an openvoxdb instance.
89+
def test_with_pdb?
90+
PuppetServerExtensions.pdb_integration_expected
7491
end
7592

7693
# Return the configuration hash initialized by

acceptance/suites/pre_suite/foss/95_install_pdb.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
skip_test('No Postgresql packages available for this platform') if unsupported_postgresql_platform?(master)
1+
test_name 'PuppetDB setup'
2+
23
skip_test('Skipped for fips') if master.fips_mode?
4+
skip_test('No Postgresql packages available for this platform') if unsupported_postgresql_platform?(master)
5+
6+
mark_pdb_integration_expected
37

4-
test_name 'PuppetDB setup'
58
sitepp = '/etc/puppetlabs/code/environments/production/manifests/site.pp'
69

710
teardown do

acceptance/suites/tests/00_smoke/puppetdb_integration.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515
## to ensure that metrics related to PuppetDB communication were recorded.
1616
#
1717

18-
# We only run this test if we'll have puppetdb installed, which is gated in
19-
# acceptance/suites/pre_suite/foss/95_install_pdb.rb using the same conditional
20-
skip_test('openvoxdb was not configured on this platform due to lack of postgresql packages') if unsupported_postgresql_platform?(master)
18+
# We only run this test if we'll have puppetdb installed and
19+
# configured, which is gated in
20+
# acceptance/suites/pre_suite/foss/95_install_pdb.rb.
21+
skip_test('openvoxdb was not configured on this platform due to lack of postgresql packages') if !test_with_pdb?
2122
skip_test('Skipped for fips') if master.fips_mode?
2223
skip_test if master.is_pe?
2324

acceptance/suites/tests/catalog/v4_catalog.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,7 @@
3232

3333
old_puppet_conf = puppet_conf_for(master, {})
3434
testdir = master.tmpdir('v4catalog')
35-
pdb = on(master,
36-
'[ -d /etc/puppetlabs/puppetdb ]',
37-
allow_failure).
38-
exit_code == 0
35+
pdb = test_with_pdb?
3936

4037
def conf_for(non_root_agent)
4138
<<PUPPETCONF

0 commit comments

Comments
 (0)