diff --git a/t/Makefile.am b/t/Makefile.am index 9cad2e654164..af6eea721050 100644 --- a/t/Makefile.am +++ b/t/Makefile.am @@ -216,6 +216,7 @@ TESTSCRIPTS = \ t2617-job-shell-stage-in.t \ t2618-job-shell-signal.t \ t2619-job-shell-hwloc.t \ + t2620-job-shell-mustache.t \ t2710-python-cli-submit.t \ t2711-python-cli-run.t \ t2713-python-cli-bulksubmit.t \ diff --git a/t/t2620-job-shell-mustache.t b/t/t2620-job-shell-mustache.t new file mode 100755 index 000000000000..ab13f23b2c32 --- /dev/null +++ b/t/t2620-job-shell-mustache.t @@ -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