Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions acceptance/lib/puppet/acceptance/temp_file_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module TempFileUtils
def root_user(host)
case host['platform']
when /windows/
'Administrator'
host['user']
else
'root'
end
Expand Down Expand Up @@ -160,7 +160,7 @@ def initialize_temp_dirs()

# we need one list of all of the hosts, to assist in managing temp dirs. It's possible
# that the master is also an agent, so this will consolidate them into a unique set
@all_hosts = Set[master, *agents]
@all_hosts = Set.new([master, *agents].compact)

# now we can create a hash of temp dirs--one per host, and unique to this test--without worrying about
# doing it twice on any individual host
Expand Down
2 changes: 1 addition & 1 deletion acceptance/lib/puppet/acceptance/windows_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def deny_administrator_access_to(host, filepath)
mkdir -Force $env:TMP\\fake-dir-for-acl
$acl = Get-ACL $env:TMP\\fake-dir-for-acl
rm -Force $env:TMP\\fake-dir-for-acl
$ar = New-Object system.security.accesscontrol.filesystemaccessrule("Administrator","FullControl","Deny")
$ar = New-Object system.security.accesscontrol.filesystemaccessrule("#{host['user']}","FullControl","Deny")
$acl.SetAccessRule($ar)
Set-ACL #{filepath} $acl
PS1
Expand Down
12 changes: 9 additions & 3 deletions acceptance/tests/agent/agent_disable_lockfile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# The validation of the `vardir` at the OS level
# should be accomplished in another test.
'audit:high',
'audit:refactor', # This test should not require a master. Remove the use of `with_puppet_running_on`.
'shard:group1' # For splitting out groups of tests for slow test runners

#
Expand Down Expand Up @@ -39,7 +38,11 @@
["I'm busy; go away.'", true]
]

with_puppet_running_on(master, {}) do
def with_server_if_present(&block)
master ? with_puppet_running_on(master, {}, &block) : block.call
end

with_server_if_present do
tuples.each do |expected_message, explicitly_specify_message|
step "disable the agent; specify message? '#{explicitly_specify_message}', message: '#{expected_message}'" do
agents.each do |agent|
Expand Down Expand Up @@ -87,12 +90,15 @@
end
end

# A full agent run needs a server, so it only runs where there is one.
next unless master

step "verify that we can run the agent (message: '#{expected_message}')" do
agents.each do |agent|
on(agent, puppet('agent', "--test"))
end
end
end # tuples block
end # with_puppet_running_on block
end # with_server_if_present block

@all_tests_passed = true
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
test_name "agent run should fail if it finds an unknown resource type" do
tag 'audit:high',
'audit:integration',
'server',
'shard:group2' # For splitting out groups of tests for slow test runners

require 'puppet/acceptance/common_utils'
Expand Down
1 change: 1 addition & 0 deletions acceptance/tests/agent/fallback_to_cached_catalog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
tag 'audit:high',
'audit:integration', # This test is not OS sensitive.
'audit:refactor', # A catalog fixture can be used for this test. Remove the usage of `with_puppet_running_on`.
'server',
'shard:group4' # For splitting out groups of tests for slow test runners

step "run agents once to cache the catalog" do
Expand Down
1 change: 1 addition & 0 deletions acceptance/tests/agent/last_run_summary_report.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
test_name "The 'last_run_summary.yaml' report has the right location and permissions" do
tag 'audit:high',
'server',
'shard:group1' # For splitting out groups of tests for slow test runners

require 'puppet/acceptance/temp_file_utils'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
'audit:acceptance',
'audit:refactor', # remove dependence on server by adding a
# catalog and report fixture to validate against.
'server',
'shard:group1' # For splitting out groups of tests for slow test runners

master_reportdir = create_tmpdir_for_user(master, 'reportdir')
Expand Down Expand Up @@ -48,7 +49,7 @@ def get_catalog_uuid_from_report(master_reportdir, agent_node_name)
end

step "Run with --use_cached_catalog and ensure catalog_uuid in the new report matches the cached catalog" do
on(agent, puppet("agent", "--onetime", "--no-daemonize", "--use_cached_catalog", "--vardir #{agent_vardir}"), :acceptance_exit_codes => [0,2])
on(agent, puppet("agent", "--onetime", "--no-daemonize", "--use_cached_catalog", "--vardir #{agent_vardir}"), :acceptable_exit_codes => [0,2])
report_catalog_uuid = get_catalog_uuid_from_report(master_reportdir, agent.node_name)
assert_equal(cache_catalog_uuid, report_catalog_uuid, "catalog_uuid found in cached catalog, #{cache_catalog_uuid} did not match report #{report_catalog_uuid}")
end
Expand Down
21 changes: 11 additions & 10 deletions acceptance/tests/direct_puppet/supports_utf8.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
tag 'audit:high',
'audit:acceptance',
'audit:refactor', # Review for agent side UTF validation.
'server',
'shard:group3' # For splitting out groups of tests for slow test runners

app_type = File.basename(__FILE__, '.*')
Expand Down Expand Up @@ -60,22 +61,22 @@
config_version = ''
config_version_matcher = /configuration version '(\d+)'/
on(agent, puppet("agent -t --environment '#{tmp_environment}'"),
:acceptable_exit_codes => 2).stdout do |result|
config_version = result.match(config_version_matcher)[1]
:acceptable_exit_codes => 2) do |result|
config_version = result.stdout.match(config_version_matcher)[1]
end
on(agent, "cat '#{tmp_file[agent_to_fqdn(agent)]}'").stdout do |result|
assert_equal(file_contents, result, 'file contents did not match accepted')
on(agent, "cat '#{tmp_file[agent_to_fqdn(agent)]}'") do |result|
assert_equal(file_contents, result.stdout.chomp, 'file contents did not match accepted')
end

on(agent, "rm -f '#{tmp_file[agent_to_fqdn(agent)]}'")
on(agent, puppet("agent -t --environment '#{tmp_environment}' --use_cached_catalog"),
:acceptable_exit_codes => 2).stdout do |result|
assert_match(config_version_matcher, result, 'agent did not use cached catalog')
second_config_version = result.match(config_version_matcher)[1]
asset_equal(config_version, second_config_version, 'config version should have been the same')
:acceptable_exit_codes => 2) do |result|
assert_match(config_version_matcher, result.stdout, 'agent did not use cached catalog')
second_config_version = result.stdout.match(config_version_matcher)[1]
assert_equal(config_version, second_config_version, 'config version should have been the same')
end
on(agent, "cat '#{tmp_file[agent_to_fqdn(agent)]}'").stdout do |result|
assert_equal(file_contents, result, 'file contents did not match accepted')
on(agent, "cat '#{tmp_file[agent_to_fqdn(agent)]}'") do |result|
assert_equal(file_contents, result.stdout.chomp, 'file contents did not match accepted')
end
end
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
test_name "should find existing production environment"
tag 'audit:medium',
'server',
'shard:group3' # For splitting out groups of tests for slow test runners

require 'puppet/acceptance/i18ndemo_utils'
Expand Down
5 changes: 3 additions & 2 deletions acceptance/tests/face/parser_validate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
skip_test('this test fails on windows French due to Cygwin/UTF Issues - PUP-8319,IMAGES-492') if agent['platform'] =~ /windows/ && agent['locale'] == 'fr'

step 'manifest with parser function call' do
if agent.platform !~ /windows/
# mk_tmp_environment_with_teardown uses the server's environmentpath
if agent.platform !~ /windows/ && master
tmp_environment = mk_tmp_environment_with_teardown(agent, app_type)

create_sitepp(agent, tmp_environment, <<-SITE)
Expand Down Expand Up @@ -55,7 +56,7 @@
on(agent, puppet("parser validate #{tmp_manifest}"), :accept_all_exit_codes => true) do |result|
assert_equal(result.exit_code, 1, 'parser validate did not exit with 1 upon parse failure')
expected = /Error: Could not parse for environment production: This Name has no effect\. A value was produced and then forgotten \(one or more preceding expressions may have the wrong form\) \(file: .*_broken\.pp, line: 1, column: 1\)/
assert_match(expected, result.output, "parser validate did not output correctly: '#{result.output}'. expected: '#{expected.to_s}'") unless agent['locale'] == 'ja'
assert_match(expected, result.stderr, "parser validate did not output correctly: '#{result.stderr}'. expected: '#{expected.to_s}'") unless agent['locale'] == 'ja'
end
end

Expand Down
1 change: 1 addition & 0 deletions acceptance/tests/i18n/enable_option_disable_i18n.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

tag 'audit:medium',
'audit:acceptance',
'server',
'shard:group3' # For splitting out groups of tests for slow test runners

require 'puppet/acceptance/environment_utils.rb'
Expand Down
1 change: 1 addition & 0 deletions acceptance/tests/i18n/modules/puppet_agent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

tag 'audit:medium',
'audit:acceptance',
'server',
'shard:group4' # For splitting out groups of tests for slow test runners

skip_test('i18n test module uses deprecated function; update module to resume testing.')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

tag 'audit:medium',
'audit:acceptance',
'server',
'shard:group1' # For splitting out groups of tests for slow test runners

skip_test('i18n test module uses deprecated function; update module to resume testing.')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

tag 'audit:medium',
'audit:acceptance',
'server',
'shard:group2' # For splitting out groups of tests for slow test runners

require 'puppet/acceptance/environment_utils.rb'
Expand Down
1 change: 1 addition & 0 deletions acceptance/tests/i18n/translation_fallback.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

tag 'audit:medium',
'audit:acceptance',
'server',
'shard:group1' # For splitting out groups of tests for slow test runners

agents.each do |agent|
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
test_name 'C100303: Resource type statement triggered auto-loading works both with and without generated types' do
tag 'risk:high',
'server',
'shard:group3' # For splitting out groups of tests for slow test runners

require 'puppet/acceptance/environment_utils.rb'
Expand Down
1 change: 1 addition & 0 deletions acceptance/tests/loader/resource_triggers_autoload.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
test_name 'C100296: can auto-load defined types using a Resource statement' do
tag 'risk:high',
'server',
'shard:group1' # For splitting out groups of tests for slow test runners

require 'puppet/acceptance/environment_utils.rb'
Expand Down
1 change: 1 addition & 0 deletions acceptance/tests/lookup/hiera3_custom_backend.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
'audit:acceptance',
'audit:refactor', # Master is not needed for this test. Refactor
# to use puppet apply with a local module tree.
'server',
'shard:group4' # For splitting out groups of tests for slow test runners

skip_test 'puppetserver gem install needs jruby-openssl for https sources, which does not load in FIPS mode' if master.fips_mode?
Expand Down
1 change: 1 addition & 0 deletions acceptance/tests/lookup/hiera_eyaml_backend.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

tag 'audit:high',
'audit:acceptance',
'server',
'shard:group1' # For splitting out groups of tests for slow test runners

skip_test 'hiera-eyaml needs jruby-openssl, which does not load in puppetserver in FIPS mode' if master.fips_mode?
Expand Down
1 change: 1 addition & 0 deletions acceptance/tests/lookup/merge_strategies.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
'audit:acceptance',
'audit:refactor', # Master is not needed for this test. Refactor
# to use puppet apply with a local module tree.
'server',
'shard:group4' # For splitting out groups of tests for slow test runners

app_type = File.basename(__FILE__, '.*')
Expand Down
3 changes: 2 additions & 1 deletion acceptance/tests/lookup/v3_config_and_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
'audit:acceptance',
'audit:refactor', # Master is not needed for this test. Refactor
# to use puppet apply with a local module tree.
'server',
'shard:group1' # For splitting out groups of tests for slow test runners

app_type = File.basename(__FILE__, '.*')
Expand Down Expand Up @@ -71,7 +72,7 @@
SITE

on(master, "chmod -R 775 #{fq_tmp_environmentpath}")
on(master, "chmod -R 775 #{confdir}")
on(master, "chmod 755 #{confdir}/hiera.yaml")
end
end

Expand Down
11 changes: 1 addition & 10 deletions acceptance/tests/lookup/v4_hieradata_with_v5_configs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
'audit:acceptance',
'audit:refactor', # Master is not needed for this test. Refactor
# to use puppet apply with a local module tree.
'server',
'shard:group2' # For splitting out groups of tests for slow test runners

app_type = File.basename(__FILE__, '.*')
Expand Down Expand Up @@ -44,16 +45,6 @@
path: "common.yaml"
HIERA
on(master, "chmod 755 #{confdir}/hiera.yaml")
create_remote_file(master, "#{confdir}/#{tmp_environment}.yaml", <<-YAML)
---
environment_key: environment_key-global_env_file
global_key: global_key-global_env_file
YAML
create_remote_file(master, "#{confdir}/common.yaml", <<-YAML)
---
environment_key: environment_key-global_common_file
global_key: global_key-global_common_file
YAML
end

step "create environment hiera.yaml and data" do
Expand Down
1 change: 1 addition & 0 deletions acceptance/tests/modulepath.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
test_name 'Supports vendored modules' do
tag 'risk:high',
'server',
'shard:group3' # For splitting out groups of tests for slow test runners

# beacon custom type emits a message so we can tell where the
Expand Down
4 changes: 2 additions & 2 deletions acceptance/tests/parser_functions/calling_all_functions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def manifest_call_each_function_from_array(functions)
functions_4x.each do |function|
expected = "#{function[:name].capitalize}: #{scope} #{function[:expected]}"
unless agent['locale'] == 'ja'
assert_match(expected, result.output,
assert_match(expected, result.stdout + result.stderr,
"#{function[:name]} output didn't match expected value")
end
end
Expand Down Expand Up @@ -228,7 +228,7 @@ def manifest_call_each_function_from_array(functions)
end

unless agent['locale'] == 'ja'
assert_match(expected, result.output, "#{function[:name]} output didn't match expected value")
assert_match(expected, result.stdout + result.stderr, "#{function[:name]} output didn't match expected value")
end
end
end
Expand Down
1 change: 1 addition & 0 deletions acceptance/tests/parser_functions/hiera/lookup_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
tag 'audit:high',
'audit:acceptance',
'audit:refactor', # Master is not required for this test. Replace with agents.each
'server',
'shard:group2' # For splitting out groups of tests for slow test runners

testdir = master.tmpdir('hiera')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
tag 'audit:high',
'audit:acceptance',
'audit:refactor', # Master is not required for this test. Replace with agents.each
'server',
'shard:group3' # For splitting out groups of tests for slow test runners

testdir = master.tmpdir('hiera')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
tag 'audit:high',
'audit:acceptance',
'audit:refactor', # Master is not required for this test. Replace with agents.each
'server',
'shard:group4' # For splitting out groups of tests for slow test runners

testdir = master.tmpdir('hiera')
Expand Down
Loading
Loading