Skip to content

Commit

Permalink
(maint) Update acceptance tests to run without service
Browse files Browse the repository at this point in the history
By relying on the puppet service to upgrade puppet we lose all logging
info in case something fails, which makes things difficult to debug.
Change to run with puppet agent -t.

We can also fix the logging part by configuring puppet to log to a file,
then printing the contents of the file.
  • Loading branch information
GabrielNagy committed Apr 20, 2021
1 parent 5679b8c commit a180f5d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
2 changes: 1 addition & 1 deletion acceptance/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ def wait_for_installation_pid(host)
end

step "(Agent) waiting for upgrade pid file to be created..." do
retry_on(host, "cat #{upgrade_pidfile}", {:max_retries => 5, :retry_interval => 2})
retry_on(host, "cat #{upgrade_pidfile}", {:max_retries => 10, :retry_interval => 2})
end

step "(Agent) waiting for upgrade to complete..." do
Expand Down
11 changes: 9 additions & 2 deletions acceptance/tests/test_upgrade_puppet5_to_puppet6.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ class { puppet_agent:
apt_source => 'http://nightlies.puppet.com/apt',
yum_source => 'http://nightlies.puppet.com/yum',
windows_source => 'http://nightlies.puppet.com/downloads',
collection => 'puppet6-nightly'
collection => 'puppet6-nightly',
service_names => []
}
}
PP
Expand All @@ -39,9 +40,15 @@ class { puppet_agent:

step "Upgrade the agents from Puppet 5 to Puppet 6..." do
agents_only.each do |agent|
start_puppet_service_and_wait_for_puppet_run(agent)
on(agent, puppet("agent -t --debug"), acceptable_exit_codes: 2)
wait_for_installation_pid(agent)
assert_agent_version_on(agent, latest_version.scan(/6\.\d*\.\d*\.\d*/).first)
end
end

step "Run again for idempotency" do
agents_only.each do |agent|
on(agent, puppet("agent -t --debug"), acceptable_exit_codes: 0)
end
end
end
11 changes: 9 additions & 2 deletions acceptance/tests/test_upgrade_puppet6_to_puppet7.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ class { puppet_agent:
apt_source => 'http://nightlies.puppet.com/apt',
yum_source => 'http://nightlies.puppet.com/yum',
windows_source => 'http://nightlies.puppet.com/downloads',
collection => 'puppet7-nightly'
collection => 'puppet7-nightly',
service_names => []
}
}
PP
Expand All @@ -39,9 +40,15 @@ class { puppet_agent:

step "Upgrade the agents from Puppet 6 to Puppet 7..." do
agents_only.each do |agent|
start_puppet_service_and_wait_for_puppet_run(agent)
on(agent, puppet("agent -t --debug"), acceptable_exit_codes: 2)
wait_for_installation_pid(agent)
assert_agent_version_on(agent, latest_version.scan(/7\.\d*\.\d*\.\d*/).first)
end
end

step "Run again for idempotency" do
agents_only.each do |agent|
on(agent, puppet("agent -t --debug"), acceptable_exit_codes: 0)
end
end
end

0 comments on commit a180f5d

Please sign in to comment.