Skip to content

Commit

Permalink
t/t2000-wreck-env.t: add tests for wreck global environment
Browse files Browse the repository at this point in the history
Add tests for wreck global environment lwj.environ, and corresponding
commands to manipulate and use that environemnt.

Note: the test is split from t2000-wreck.t but still prefixed with
t2000 for easier test devlepment, parallel tests, etc. Since this is
short-lived code, it is probably ok for now.
  • Loading branch information
grondo committed Mar 31, 2018
1 parent e1fb7d3 commit 8faa637
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
2 changes: 2 additions & 0 deletions t/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ TESTS = \
t1104-kz.t \
t1105-proxy.t \
t2000-wreck.t \
t2000-wreck-env.t \
t2001-jsc.t \
t2002-pmi.t \
t2003-recurse.t \
Expand Down Expand Up @@ -137,6 +138,7 @@ check_SCRIPTS = \
t1104-kz.t \
t1105-proxy.t \
t2000-wreck.t \
t2000-wreck-env.t \
t2001-jsc.t \
t2002-pmi.t \
t2003-recurse.t \
Expand Down
51 changes: 51 additions & 0 deletions t/t2000-wreck-env.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/sh
#

test_description='Test basic wreck functionality
Test basic functionality of wreckrun facility.
'

. `dirname $0`/sharness.sh
SIZE=${FLUX_TEST_SIZE:-4}
test_under_flux ${SIZE} wreck

# Return the previous jobid
last_job_id() {
flux wreck last-jobid
}
# Return previous job path in kvs
last_job_path() {
flux wreck last-jobid -p
}

test_expect_success 'flux-wreck: setenv/getenv works' '
flux wreck setenv FOO=BAR &&
flux wreck getenv FOO
'
test_expect_success 'flux-wreck: unsetenv works' '
flux wreck unsetenv FOO &&
test "$(flux wreck getenv FOO)" = "FOO="
'
test_expect_success 'flux-wreck: setenv all' '
flux wreck setenv all &&
flux env /usr/bin/env | sort | grep -ve FLUX_URI -e HOSTNAME -e ENVIRONMENT > env.expected &&
flux wreck getenv | sort > env.output &&
test_cmp env.expected env.output
'
test_expect_success 'wreck: global lwj.environ exported to jobs' '
flux wreck setenv FOO=bar &&
test "$(flux wreckrun -n1 printenv FOO)" = "bar"
'
test_expect_success 'wreck: wreckrun exports environment vars not in global env' '
BAR=baz flux wreckrun -n1 printenv BAR > printenv.out &&
test "$(cat printenv.out)" = "baz"
'
test_expect_success 'wreck: wreckrun --skip-env works' '
( export BAR=baz &&
test_must_fail flux wreckrun --skip-env -n1 printenv BAR > printenv2.out
) &&
test "$(cat printenv2.out)" = ""
'

test_done

0 comments on commit 8faa637

Please sign in to comment.