diff options
author | Paul Lathrop <paul@tertiusfamily.net> | 2008-02-05 14:05:14 -0800 |
---|---|---|
committer | Paul Lathrop <paul@tertiusfamily.net> | 2008-02-05 14:05:14 -0800 |
commit | 8f0d87d498ca12417a7d20b81ba46465658fa210 (patch) | |
tree | 0e2274bda34a14929d1dfcf09d36e27c9d7d2ac1 /test | |
parent | 139ff33e1f93a0634547fc9a06442a720fe0a58e (diff) | |
download | puppet-8f0d87d498ca12417a7d20b81ba46465658fa210.tar.gz puppet-8f0d87d498ca12417a7d20b81ba46465658fa210.tar.xz puppet-8f0d87d498ca12417a7d20b81ba46465658fa210.zip |
Added :env parameter for backwards-compatibility, with warning about deprecation. :env parameter sets new :environment parameter. Changed instances of :env to :environment for consistency with other types. Added tests for new parameters. This cimmit fixes ticket 1007.
Diffstat (limited to 'test')
-rwxr-xr-x | test/ral/types/exec.rb | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/test/ral/types/exec.rb b/test/ral/types/exec.rb index f718f944e..4133d8519 100755 --- a/test/ral/types/exec.rb +++ b/test/ral/types/exec.rb @@ -587,6 +587,46 @@ and stuff" assert_equal("A B\n", output) end + def test_environmentparam + exec = Puppet::Type.newexec( + :command => "echo $environmenttest", + :path => ENV["PATH"], + :environment => "environmenttest=yayness" + ) + + assert(exec, "Could not make exec") + + output = status = nil + assert_nothing_raised { + output, status = exec.run("echo $environmenttest") + } + + assert_equal("yayness\n", output) + + # Now check whether we can do multiline settings + assert_nothing_raised do + exec[:environment] = "environmenttest=a list of things +and stuff" + end + + output = status = nil + assert_nothing_raised { + output, status = exec.run('echo "$environmenttest"') + } + assert_equal("a list of things\nand stuff\n", output) + + # Now test arrays + assert_nothing_raised do + exec[:environment] = ["funtest=A", "yaytest=B"] + end + + output = status = nil + assert_nothing_raised { + output, status = exec.run('echo "$funtest" "$yaytest"') + } + assert_equal("A B\n", output) + end + def test_timeout exec = Puppet::Type.type(:exec).create(:command => "sleep 1", :path => ENV["PATH"], :timeout => "0.2") time = Time.now |