forked from flux-framework/flux-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
testsuite: add t2620-job-shell-mustache.t
Problem: There are no specific tests for testing shell mustache template expansion. Add t2620-job-shell-mustache.t for this purpose.
- Loading branch information
Showing
2 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
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
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,46 @@ | ||
#!/bin/sh | ||
# | ||
test_description='Test flux-shell mustache template rendering' | ||
|
||
. `dirname $0`/sharness.sh | ||
|
||
test_under_flux 2 job | ||
|
||
test_expect_success 'mustache: templates are rendered in job arguments' ' | ||
flux run -N2 -n4 \ | ||
echo {{id.words}}: size={{size}} nnodes={{nnodes}} name={{name}} \ | ||
>output.1 && | ||
test_debug "cat output.1" && | ||
grep "size=4 nnodes=2 name=echo" output.1 | ||
' | ||
test_expect_success 'mustache: per-task tags work' ' | ||
flux run -N2 -n4 --label-io \ | ||
echo rank={{task.rank}} index={{task.index}} \ | ||
| sort >output.2 && | ||
test_debug "cat output.2" && | ||
cat <<-EOF >expected.2 && | ||
0: rank=0 index=0 | ||
1: rank=1 index=1 | ||
2: rank=2 index=0 | ||
3: rank=3 index=1 | ||
EOF | ||
test_cmp expected.2 output.2 | ||
' | ||
test_expect_success 'mustache: per-node tags work' ' | ||
flux run -N2 -n2 --label-io \ | ||
echo id={{node.id}} name={{node.name}} cores={{node.cores}}[{{node.ncores}}] \ | ||
| sort >output.3 && | ||
test_debug "cat output.3" && | ||
cat <<-EOF >expected.3 && | ||
0: id=0 name=$(hostname) cores=0[1] | ||
1: id=1 name=$(hostname) cores=0[1] | ||
EOF | ||
test_cmp expected.3 output.3 | ||
' | ||
test_expect_success 'mustache: unsupported tag is left alone' ' | ||
flux run echo {{foo}} {{node.foo}} {{task.foo}} >output.4 && | ||
test_debug "cat output.4" && | ||
test "$(cat output.4)" = "{{foo}} {{node.foo}} {{task.foo}}" | ||
' | ||
|
||
test_done |