File tree Expand file tree Collapse file tree 3 files changed +8
-12
lines changed Expand file tree Collapse file tree 3 files changed +8
-12
lines changed Original file line number Diff line number Diff line change 243243 }
244244
245245 after ( :each ) do
246- run_shell ( interpolate_powershell ( "Remove-Item Env:\\ superspecial -ErrorAction Ignore;exit 0" ) )
247- run_shell ( interpolate_powershell ( "Remove-Item Env:\\ outside -ErrorAction Ignore;exit 0" ) )
246+ run_shell ( PuppetLitmus :: Util . interpolate_powershell ( "Remove-Item Env:\\ superspecial -ErrorAction Ignore;exit 0" ) )
247+ run_shell ( PuppetLitmus :: Util . interpolate_powershell ( "Remove-Item Env:\\ outside -ErrorAction Ignore;exit 0" ) )
248248 end
249249
250250 it 'should not see environment variable from previous run' do
258258 it 'should see environment variables set outside of session' do
259259 # Setup the environment variable outside of Puppet
260260
261- run_shell ( interpolate_powershell ( "$env:outside='1'" ) )
261+ run_shell ( PuppetLitmus :: Util . interpolate_powershell ( "$env:outside='1'" ) )
262262
263263 # Test to see if initial run sees the environment variable
264264 apply_manifest ( envar_leak_test_pp , expect_changes : true )
Original file line number Diff line number Diff line change @@ -280,8 +280,8 @@ def platform_string(windows, posix)
280280 after ( :each ) do
281281 # Due to https://tickets.puppetlabs.com/browse/BKR-1088, need to use different commands
282282 if windows_platform?
283- run_shell ( interpolate_powershell ( "Remove-Item Env:\\ superspecial -ErrorAction Ignore;exit 0" ) )
284- run_shell ( interpolate_powershell ( "Remove-Item Env:\\ outside -ErrorAction Ignore;exit 0" ) )
283+ run_shell ( PuppetLitmus :: Util . interpolate_powershell ( "Remove-Item Env:\\ superspecial -ErrorAction Ignore;exit 0" ) )
284+ run_shell ( PuppetLitmus :: Util . interpolate_powershell ( "Remove-Item Env:\\ outside -ErrorAction Ignore;exit 0" ) )
285285 else
286286 run_shell ( 'unset superspecial' )
287287 run_shell ( 'unset outside' )
@@ -301,7 +301,7 @@ def platform_string(windows, posix)
301301
302302 # Due to https://tickets.puppetlabs.com/browse/BKR-1088, need to use different commands
303303 if windows_platform?
304- run_shell ( interpolate_powershell ( "\$ env:outside='1'" ) )
304+ run_shell ( PuppetLitmus :: Util . interpolate_powershell ( "\$ env:outside='1'" ) )
305305 else
306306 run_shell ( 'export outside=1' )
307307 end
Original file line number Diff line number Diff line change 11require 'puppet_litmus'
2+ require 'puppet_litmus/util'
23require 'singleton'
34
45class Helper
@@ -32,7 +33,7 @@ def uninstall_pwsh
3233 when 'darwin'
3334 'brew cask uninstall powershell'
3435 when 'windows'
35- interpolate_powershell ( 'Get-Command pwsh | ForEach-Object { Remove-Item -Path (Split-Path -Parent $_.Path) -Recurse -Force }' )
36+ PuppetLitmus :: Util . interpolate_powershell ( 'Get-Command pwsh | ForEach-Object { Remove-Item -Path (Split-Path -Parent $_.Path) -Recurse -Force }' )
3637 end
3738 Helper . instance . run_shell ( command )
3839end
@@ -50,11 +51,6 @@ def cleanup_files
5051 Helper . instance . apply_manifest ( absent_files_manifest , catch_failures : true )
5152end
5253
53- def interpolate_powershell ( command )
54- encoded_command = Base64 . strict_encode64 ( command . encode ( 'UTF-16LE' ) )
55- "powershell.exe -NoProfile -EncodedCommand #{ encoded_command } "
56- end
57-
5854def relative_folder ( relative_path )
5955 expanded_path = File . expand_path ( File . join ( File . dirname ( __FILE__ ) , relative_path ) )
6056 Dir . open ( expanded_path ) if File . exist? ( expanded_path )
You can’t perform that action at this time.
0 commit comments