Skip to content

Commit

Permalink
(PUP-9653) Fix environmentpath in mk_tmp_env tests
Browse files Browse the repository at this point in the history
This commit changes tests using the `mk_tmp_env` helper to introspect the
environment path from the puppet `environmentpath` rather than
hard-coding the `/tmp` directory.

This change is necessary to accommodate updates to the helper that ensure
that the `environmentpath` is updated from the temporary environment,
but that ad-hoc changes to the generated temp directory will not be
updated.  This is necessary because Windows cannot link the environment
path to the generated temp directory.
  • Loading branch information
johnduarte committed May 28, 2019
1 parent bb8f3be commit 0a29118
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,19 @@

language = 'ja_JP'

agents.each do |agent|
skip_test('on windows this test only works on a machine with a japanese code page set') if agent['platform'] =~ /windows/ && agent['locale'] != 'ja'

agent_language = enable_locale_language(agent, language)
skip_test("test machine is missing #{agent_language} locale. Skipping") if agent_language.nil?
end

app_type_1 = File.basename(__FILE__, '.*') + "_env_1"
app_type_2 = File.basename(__FILE__, '.*') + "_env_2"
tmp_environment_1 = mk_tmp_environment_with_teardown(master, app_type_1)
tmp_environment_2 = mk_tmp_environment_with_teardown(master, app_type_2)
full_path_env_1 = File.join('/tmp', tmp_environment_1)
full_path_env_2 = File.join('/tmp', tmp_environment_2)
full_path_env_1 = "#{environmentpath}/#{tmp_environment_1}"
full_path_env_2 = "#{environmentpath}/#{tmp_environment_2}"
tmp_po_file = master.tmpfile('tmp_po_file')

step 'install a i18ndemo module' do
Expand All @@ -49,10 +56,7 @@
end

agents.each do |agent|
skip_test('on windows this test only works on a machine with a japanese code page set') if agent['platform'] =~ /windows/ && agent['locale'] != 'ja'

agent_language = enable_locale_language(agent, language)
skip_test("test machine is missing #{agent_language} locale. Skipping") if agent_language.nil?
shell_env_language = { 'LANGUAGE' => agent_language, 'LANG' => agent_language }

env_1_po_file = File.join(full_path_env_1, 'modules', I18NDEMO_NAME, 'locales', 'ja', "#{I18NDEMO_MODULE_NAME}.po")
Expand Down
4 changes: 2 additions & 2 deletions acceptance/tests/language/pcore_generate_env_isolation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
create_sitepp(master, tmp_environment2, site_pp2)
end

on master, "chmod -R 755 /tmp/#{tmp_environment}"
on master, "chmod -R 755 /tmp/#{tmp_environment2}"
on master, "chmod -R 755 #{fq_tmp_environmentpath}"
on master, "chmod -R 755 #{fq_tmp_environmentpath2}"

with_puppet_running_on(master,{}) do
agents.each do |agent|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def empty_execution_log_file(host, path)
PP
create_sitepp(master, tmp_environment, site_pp)
end
on(master, "chmod -R 755 '/tmp/#{tmp_environment}'")
on(master, "chmod -R 755 '#{fq_tmp_environmentpath}'")

# when the agent does its run, the newtype is executed on both the agent and master nodes
# so we should see a message in the execution log file on the agent and the master
Expand Down
2 changes: 1 addition & 1 deletion acceptance/tests/loader/resource_triggers_autoload.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
create_sitepp(master, tmp_environment, site_pp)
end

on(master, "chmod -R 755 /tmp/#{tmp_environment}")
on(master, "chmod -R 755 #{fq_tmp_environmentpath}")

with_puppet_running_on(master, {}) do
agents.each do |agent|
Expand Down

0 comments on commit 0a29118

Please sign in to comment.