Skip to content

Commit 23af9ad

Browse files
Merge pull request #2891 from span786/SERVER-3390-maint-fixes-for-ci-acceptance-tests
(SERVER-3390): Maintenance fixes in ci acceptance tests for 7.x
2 parents 3273250 + 2adc2d9 commit 23af9ad

File tree

16 files changed

+166
-148
lines changed

16 files changed

+166
-148
lines changed

Gemfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ gem 'rake', :group => [:development, :test]
1818

1919
group :test do
2020
gem 'rspec'
21-
gem 'beaker', *location_for(ENV['BEAKER_VERSION'] || '~> 4.11')
21+
gem 'beaker', *location_for(ENV['BEAKER_VERSION'] || '~> 5.4')
2222
gem "beaker-hostgenerator", *location_for(ENV['BEAKER_HOSTGENERATOR_VERSION'] || "~> 2.4")
23-
gem "beaker-abs", *location_for(ENV['BEAKER_ABS_VERSION'] || "~> 0.1")
23+
gem "beaker-abs", *location_for(ENV['BEAKER_ABS_VERSION'] || "~> 1.0")
2424
gem "beaker-vmpooler", *location_for(ENV['BEAKER_VMPOOLER_VERSION'] || "~> 1.3")
25-
gem "beaker-puppet", *location_for(ENV['BEAKER_PUPPET_VERSION'] || ["~> 1.0", ">= 1.0.1"])
25+
gem "beaker-puppet", *location_for(ENV['BEAKER_PUPPET_VERSION'] || "~> 4.0")
2626
gem 'uuidtools'
2727
gem 'httparty'
2828
gem 'master_manipulator'

acceptance/lib/helper.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,7 @@ def get_defaults_file
229229
def get_defaults_var(host, varname)
230230
defaults_file = get_defaults_file
231231

232-
on(host, "source #{defaults_file}; echo -n $#{varname}")
233-
stdout
232+
on(host, "source #{defaults_file}; echo -n $#{varname}").stdout
234233
end
235234

236235
# If we are getting the certificate for the first time, store it in the

acceptance/lib/puppetserver/acceptance/gem_utils.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ def get_gem_list(host, gem_list_command)
77
#
88
gem_list_regex = Regexp.new('(?<package>[\w-]*) (?<version>.*)')
99
array = []
10-
on(host, "#{gem_list_command}") do
11-
split_output = stdout.split
10+
on(host, "#{gem_list_command}") do |result|
11+
split_output = result.stdout.split
1212
split_output.each do |line|
1313
match = gem_list_regex.match(line)
1414
if match

acceptance/scripts/generic/testrun.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ do_init()
1515
BEAKER_INIT="$BEAKER_INIT --keyfile $BEAKER_KEYFILE"
1616
BEAKER_INIT="$BEAKER_INIT --helper $BEAKER_HELPER"
1717
BEAKER_INIT="$BEAKER_INIT --options-file $BEAKER_OPTIONS"
18-
BEAKER_INIT="$BEAKER_INIT --post-suite $BEAKER_POSTSUITE"
1918
BEAKER_INIT="$BEAKER_INIT --load-path $BEAKER_LOADPATH"
2019
BEAKER_INIT="$BEAKER_INIT --hosts $BEAKER_CONFIG"
2120
BEAKER_INIT="$BEAKER_INIT --pre-suite $BEAKER_PRESUITE"
@@ -42,7 +41,6 @@ export GEM_SOURCE="https://artifactory.delivery.puppetlabs.net/artifactory/api/g
4241
export GENCONFIG_LAYOUT="${GENCONFIG_LAYOUT:-redhat8-64ma-debian11-64a}"
4342
export BEAKER_TESTSUITE="${BEAKER_TESTSUITE:-acceptance/suites/tests}"
4443
export BEAKER_PRESUITE="${BEAKER_PRESUITE:-acceptance/suites/pre_suite/foss}"
45-
export BEAKER_POSTSUITE="${BEAKER_POSTSUITE:-acceptance/suites/post_suite}"
4644
export BEAKER_OPTIONS="${BEAKER_OPTIONS:-acceptance/config/beaker/options.rb}"
4745
export BEAKER_CONFIG="${BEAKER_CONFIG:-acceptance/scripts/hosts.cfg}"
4846
export BEAKER_KEYFILE="${BEAKER_KEYFILE:-~/.ssh/id_rsa-acceptance}"

acceptance/suites/puppet3_tests/puppet3_version_test.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
legacy_agents = agents.reject { |agent| agent == master }
55

66
step "Check that legacy agents have Puppet 3.x installed"
7-
on(legacy_agents, puppet("--version")) do
8-
assert(stdout.start_with? "3.", "puppet --version does not start with major version 3.")
7+
on(legacy_agents, puppet("--version")) do |result|
8+
assert(result.stdout.start_with? "3.", "puppet --version does not start with major version 3.")
99
end
1010

1111
step "Check that Puppet Server has Puppet 6.x installed"
12-
on(master, puppet("--version")) do
13-
assert_match(/\A6/, stdout, "puppet --version does not start with major version 6.x")
12+
on(master, puppet("--version")) do |result|
13+
assert_match(/\A6/, result.stdout, "puppet --version does not start with major version 6.x")
1414
end
1515

1616
step "Check that the agent on the master runs against the master"

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@
101101
# ISO 8601 timestamp, with milliseconds and time zone. Local time is used
102102
# instead of UTC as both PuppetDB and Puppet Server log in local time.
103103
run_timestamp = Time.iso8601(on(master, 'date +"%Y-%m-%dT%H:%M:%S.%3N%:z"').stdout.chomp)
104-
on(master, puppet_agent("--test"), :acceptable_exit_codes => [0,2]) do
105-
assert_match(/Notice: #{random_string}/, stdout,
104+
on(master, puppet_agent("--test"), :acceptable_exit_codes => [0,2]) do |result|
105+
assert_match(/Notice: #{random_string}/, result.stdout,
106106
'Puppet run collects exported Notify')
107107
end
108108
end

acceptance/suites/tests/010-puppetserver-cli/subcommand/SERVER-297_common_behavior.rb

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
proxy_env_vars = "HTTP_PROXY=foo http_proxy=foo HTTPS_PROXY=foo https_proxy=foo NO_PROXY=foo no_proxy=foo"
66

77
step "ruby: Check that PATH, HOME, GEM_HOME JARS_REQUIRE and JARS_NO_REQUIRE are present"
8-
on(master, "puppetserver ruby -rjson -e 'puts JSON.pretty_generate(ENV.to_hash)'") do
9-
env = JSON.parse(stdout)
8+
on(master, "puppetserver ruby -rjson -e 'puts JSON.pretty_generate(ENV.to_hash)'") do |result|
9+
env = JSON.parse(result.stdout)
1010
assert(env['PATH'], "PATH missing")
1111
assert(env['HOME'], "HOME missing")
1212
assert(env['GEM_HOME'], "GEM_HOME missing")
@@ -15,8 +15,8 @@
1515
end
1616

1717
step "ruby: Check that proxy env-variables are present"
18-
on(master, "#{proxy_env_vars} puppetserver ruby -rjson -e 'puts JSON.pretty_generate(ENV.to_hash)'") do
19-
env = JSON.parse(stdout)
18+
on(master, "#{proxy_env_vars} puppetserver ruby -rjson -e 'puts JSON.pretty_generate(ENV.to_hash)'") do |result|
19+
env = JSON.parse(result.stdout)
2020
assert_equal(env['HTTP_PROXY'], "foo",
2121
"HTTP_PROXY is missing or has wrong value: '#{env['HTTP_PROXY']}'")
2222
assert_equal(env['http_proxy'], "foo",
@@ -32,20 +32,20 @@
3232
end
3333

3434
step "irb: Check that PATH, HOME, GEM_HOME JARS_REQUIRE and JARS_NO_REQUIRE are present"
35-
on(master, "echo 'puts JSON.pretty_generate(ENV.to_hash)' | puppetserver irb -f -rjson") do
36-
assert_match(/\bPATH\b/, stdout, "PATH missing")
37-
assert_match(/\bHOME\b/, stdout, "HOME missing")
38-
assert_match(/\bGEM_HOME\b/, stdout, "GEM_HOME missing")
39-
assert_match(/\bJARS_REQUIRE\b/, stdout, "JARS_REQUIRE missing")
40-
assert_match(/\bJARS_NO_REQUIRE\b/, stdout, "JARS_NO_REQUIRE missing")
35+
on(master, "echo 'puts JSON.pretty_generate(ENV.to_hash)' | puppetserver irb -f -rjson") do |result|
36+
assert_match(/\bPATH\b/, result.stdout, "PATH missing")
37+
assert_match(/\bHOME\b/, result.stdout, "HOME missing")
38+
assert_match(/\bGEM_HOME\b/, result.stdout, "GEM_HOME missing")
39+
assert_match(/\bJARS_REQUIRE\b/, result.stdout, "JARS_REQUIRE missing")
40+
assert_match(/\bJARS_NO_REQUIRE\b/, result.stdout, "JARS_NO_REQUIRE missing")
4141
end
4242

4343
step "irb: Check that proxy env-variables are present"
44-
on(master, "echo 'puts JSON.pretty_generate(ENV.to_hash)' | #{proxy_env_vars} puppetserver irb -f -rjson") do
45-
assert_match(/\bHTTP_PROXY\b\W\W\s\W\bfoo\b/, stdout, "HTTP_PROXY missing or has wrong value")
46-
assert_match(/\bhttp_proxy\b\W\W\s\W\bfoo\b/, stdout, "http_proxy missing or has wrong value")
47-
assert_match(/\bHTTPS_PROXY\b\W\W\s\W\bfoo\b/, stdout, "HTTPS_PROXY missing or has wrong value")
48-
assert_match(/\bhttps_proxy\b\W\W\s\W\bfoo\b/, stdout, "https_proxy missing or has wrong value")
49-
assert_match(/\bNO_PROXY\b\W\W\s\W\bfoo\b/, stdout, "NO_PROXY missing or has wrong value")
50-
assert_match(/\bno_proxy\b\W\W\s\W\bfoo\b/, stdout, "no_proxy missing or has wrong value")
44+
on(master, "echo 'puts JSON.pretty_generate(ENV.to_hash)' | #{proxy_env_vars} puppetserver irb -f -rjson") do |result|
45+
assert_match(/\bHTTP_PROXY\b\W\W\s\W\bfoo\b/, result.stdout, "HTTP_PROXY missing or has wrong value")
46+
assert_match(/\bhttp_proxy\b\W\W\s\W\bfoo\b/, result.stdout, "http_proxy missing or has wrong value")
47+
assert_match(/\bHTTPS_PROXY\b\W\W\s\W\bfoo\b/, result.stdout, "HTTPS_PROXY missing or has wrong value")
48+
assert_match(/\bhttps_proxy\b\W\W\s\W\bfoo\b/, result.stdout, "https_proxy missing or has wrong value")
49+
assert_match(/\bNO_PROXY\b\W\W\s\W\bfoo\b/, result.stdout, "NO_PROXY missing or has wrong value")
50+
assert_match(/\bno_proxy\b\W\W\s\W\bfoo\b/, result.stdout, "no_proxy missing or has wrong value")
5151
end

acceptance/suites/tests/010-puppetserver-cli/subcommand/foreground.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
test_name "Puppetserver 'foreground' subcommand tests."
22

3-
if (master['platform'] =~ /el-5/)
4-
skip_test("RHEL5 is not supported by this test case. See SERVER-653")
5-
end
6-
73
cli = "puppetserver"
84
service = options['puppetservice']
95

@@ -25,7 +21,7 @@
2521

2622
step "Run #{cli} with foreground subcommand, wait for #{timout_length}"
2723
on(master, timeout_cmd, :acceptable_exit_codes => [124]) do |result|
28-
assert_no_match(/error:/i, result.stderr, "Unexpected error running puppetserver!")
24+
refute_match(/error:/i, result.stderr, "Unexpected error running puppetserver!")
2925

3026
step "Check that #{cli} ran successfully and shutdown triggered"
3127
expected_messages.each do |message, explanation|

acceptance/suites/tests/010-puppetserver-cli/subcommand/gem.rb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@
4343
on(master, "#{gem_install} #{gem_name} -v #{gem_version}")
4444

4545
step "Check that test gem is present."
46-
on(master, "#{gem_list}") do
47-
assert(/^#{gem_name}/.match(stdout), "#{gem_name} was not found after installation.")
46+
on(master, "#{gem_list}") do |result|
47+
assert(/^#{gem_name}/.match(result.stdout), "#{gem_name} was not found after installation.")
4848
end
4949

5050
if gem_name == 'excon'
@@ -56,8 +56,8 @@
5656
end
5757
on(master, "su #{runuser} -s /bin/bash -c "\
5858
"'/opt/puppetlabs/bin/puppetserver ruby "\
59-
"-rexcon -e \"puts Excon::VERSION\"'") do
60-
assert_equal(gems['excon'], stdout.strip,
59+
"-rexcon -e \"puts Excon::VERSION\"'") do |result|
60+
assert_equal(gems['excon'], result.stdout.strip,
6161
"Unexpected output for excon version")
6262
end
6363
end
@@ -67,8 +67,8 @@
6767
on(master, "#{gem_uninstall} #{gem_name}")
6868

6969
step "Check that test gem is no longer present."
70-
on(master, "#{gem_list}") do
71-
assert_no_match(/^#{gem_name}/, stdout, "#{gem_name} was found after uninstallation.")
70+
on(master, "#{gem_list}") do |result|
71+
refute_match(/^#{gem_name}/, result.stdout, "#{gem_name} was found after uninstallation.")
7272
end
7373
end
7474

@@ -88,14 +88,14 @@
8888
on(master, "#{cli} gem env", :acceptable_exit_codes => [0])
8989

9090
step "Verify that Java cli args passed through to gem command"
91-
on(master, "JAVA_ARGS_CLI=-Djruby.cli.version=true #{cli} gem help") do
92-
assert_match(/jruby \d\.\d\.\d.*$/, stdout,
91+
on(master, "JAVA_ARGS_CLI=-Djruby.cli.version=true #{cli} gem help") do |result|
92+
assert_match(/jruby \d\.\d\.\d.*$/, result.stdout,
9393
'jruby version not included in gem command output')
9494
end
9595

9696
step "(SERVER-1759) Verify that installing a non-existent gem produces a non-zero exit return value"
9797

9898
gem_name = 'if-this-gem-exists-then-someone-has-a-cruel-sense-of-humor'
99-
on(master, "#{cli} gem install #{gem_name}", :acceptable_exit_codes => [2]) do
100-
assert_match(/Could not find a valid gem/, stderr)
99+
on(master, "#{cli} gem install #{gem_name}", :acceptable_exit_codes => [2]) do |result|
100+
assert_match(/Could not find a valid gem/, result.stderr)
101101
end

acceptance/suites/tests/010-puppetserver-cli/subcommand/irb.rb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,28 @@
1010

1111
step "Check that GEM_HOME is managed"
1212
cmd = "echo 'puts ENV.to_hash.to_yaml' | GEM_HOME=UHOH #{cli} irb -ryaml -f"
13-
on(master, cmd) do
14-
assert_match(/GEM_HOME/, stdout)
15-
assert_no_match(/UHOH/, stdout)
13+
on(master, cmd) do |result|
14+
assert_match(/GEM_HOME/, result.stdout)
15+
refute_match(/UHOH/, result.stdout)
1616
end
1717

1818
step "Check that FOO_DEBUG is filtered"
1919
cmd = "echo 'puts ENV[%{FOO_DEBUG}] || %{OK}' | FOO_DEBUG=BAD #{cli} irb -f"
20-
on(master, cmd) do
21-
assert_match(/^OK$/, stdout)
22-
assert_no_match(/^BAD$/, stdout, "FOO_DEBUG is not being filtered out")
20+
on(master, cmd) do |result|
21+
assert_match(/^OK$/, result.stdout)
22+
refute_match(/^BAD$/, result.stdout, "FOO_DEBUG is not being filtered out")
2323
end
2424

2525
step "Check that puppet is loadable"
2626
cmd = "echo 'puts %{GOOD: } + Puppet.version' | #{cli} irb -rpuppet -f"
27-
on(master, cmd) do
28-
assert_match(/GOOD:/, stdout)
29-
assert_no_match(/error/i, stdout)
27+
on(master, cmd) do |result|
28+
assert_match(/GOOD:/, result.stdout)
29+
refute_match(/error/i, result.stdout)
3030
end
3131

3232
step "Verify that Java cli args passed through to irb command"
33-
on(master, "echo '' | JAVA_ARGS_CLI=-Djruby.cli.version=true #{cli} irb -f") do
34-
assert_match(/jruby \d\.\d\.\d.*$/, stdout,
33+
on(master, "echo '' | JAVA_ARGS_CLI=-Djruby.cli.version=true #{cli} irb -f") do |result|
34+
assert_match(/jruby \d\.\d\.\d.*$/, result.stdout,
3535
'jruby version not included in irb command output')
3636
end
3737

0 commit comments

Comments
 (0)