Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(SERVER-297) Add acceptance tests for env behavior
Without this patch there aren't any acceptance tests that validate the behavior of environment handling. This patch addresses the problem by adding a test for the irb and ruby commands. The gem command is already tested via the `gem env` command and is difficult to inspect the environment from since it doesn't evaluate arbitrary code like irb and ruby can.
- Loading branch information
Jeff McCune
committed
Jun 5, 2015
1 parent
fcd7aa3
commit b14b711
Showing
2 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
acceptance/suites/tests/010-puppetserver-cli/subcommand/SERVER-297_common_behavior.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
require 'test/unit/assertions' | ||
require 'json' | ||
|
||
test_name "Puppetserver subcommand consolidated ENV handling tests." | ||
|
||
step "ruby: Check that PATH, HOME, GEM_HOME JARS_REQUIRE and JARS_NO_REQUIRE are present" | ||
on(master, "puppetserver ruby -rjson -e 'puts JSON.pretty_generate(ENV.to_hash)'") do | ||
env = JSON.parse(stdout) | ||
assert(env['PATH'], "PATH missing") | ||
assert(env['HOME'], "HOME missing") | ||
assert(env['GEM_HOME'], "GEM_HOME missing") | ||
assert(env['JARS_REQUIRE'], "JARS_REQUIRE missing") | ||
assert(env['JARS_NO_REQUIRE'], "JARS_NO_REQUIRE missing") | ||
end | ||
|
||
step "irb: Check that PATH, HOME, GEM_HOME JARS_REQUIRE and JARS_NO_REQUIRE are present" | ||
on(master, "puppetserver irb -f -rjson -e 'puts JSON.pretty_generate(ENV.to_hash)'") do | ||
assert_match(/\bPATH\b/, output, "PATH missing") | ||
assert_match(/\bHOME\b/, output, "HOME missing") | ||
assert_match(/\bGEM_HOME\b/, output, "GEM_HOME missing") | ||
assert_match(/\bJARS_REQUIRE\b/, output, "JARS_REQUIRE missing") | ||
assert_match(/\bJARS_NO_REQUIRE\b/, output, "JARS_NO_REQUIRE missing") | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters