Skip to content

Commit d9b0482

Browse files
committed
testsuite: add tests for flux-resource R
Problem: There are no tests of the flux-resource R subcommand. Add tests to t2350-resource-list.t to test expected output of flux resource R.
1 parent acd5635 commit d9b0482

File tree

6 files changed

+23
-0
lines changed

6 files changed

+23
-0
lines changed

t/flux-resource/list/fluxion.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"version": 1, "execution": {"R_lite": [{"rank": "0-3", "children": {"core": "0-3"}}], "starttime": 0.0, "expiration": 0.0}}

t/flux-resource/list/missing.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"version": 1, "execution": {"R_lite": [{"rank": "0-3", "children": {"core": "0-3"}}], "starttime": 0.0, "expiration": 0.0}}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"version": 1, "execution": {"R_lite": [{"rank": "0-3", "children": {"core": "0-3"}}], "starttime": 0.0, "expiration": 0.0}}

t/flux-resource/list/normal-new.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"version": 1, "execution": {"R_lite": [{"rank": "0-4", "children": {"core": "0-3"}}], "starttime": 0.0, "expiration": 0.0, "nodelist": ["pi[3,0-2,4]"], "properties": {"8g": "0-2"}}}

t/flux-resource/list/null.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"version": 1, "execution": {"R_lite": [{"rank": "0-3", "children": {"core": "0-3"}}], "starttime": 0.0, "expiration": 0.0}}

t/t2350-resource-list.t

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ for input in ${SHARNESS_TEST_SRCDIR}/flux-resource/list/*.json; do
5353
test_debug "cat ${name}-info.output" &&
5454
test_cmp ${base}-info.expected ${name}-info.output
5555
'
56+
test_expect_success "flux-resource R input check: $testname" '
57+
flux resource R --from-stdin < $input > ${name}-R.output 2>&1 &&
58+
test_debug "cat ${name}-info.output" &&
59+
test_cmp ${base}.R ${name}-R.output
60+
'
5661
done
5762

5863
# Ensure all tested inputs can also work with --include
@@ -73,6 +78,11 @@ for input in ${SHARNESS_TEST_SRCDIR}/flux-resource/list/*.json; do
7378
test_debug "cat ${name}-info-include.output" &&
7479
grep "1 Node" ${name}-info-include.output
7580
'
81+
test_expect_success "flux-resource R input ---include check: $testname" '
82+
flux resource R --from-stdin -i0 < $input \
83+
> ${name}-info-R.output &&
84+
test "$(flux R decode --count=node <${name}-info-R.output)" -eq 1
85+
'
7686
done
7787

7888
test_expect_success 'flux-resource list supports --include' '
@@ -99,6 +109,14 @@ test_expect_success 'flux-resource list: --include works with invalid host' '
99109
test_debug "cat include-invalid-hosts.out" &&
100110
grep "^0" include-invalid-hosts.out
101111
'
112+
test_expect_success 'flux-resource R supports --states' '
113+
flux resource R --from-stdin -s all <$INPUT >all.R &&
114+
test $(flux R decode --count=node <all.R) -eq 5 &&
115+
flux resource R --from-stdin -s up <$INPUT >up.R &&
116+
test $(flux R decode --count=node <up.R) -eq 5 &&
117+
flux resource R --from-stdin -s down <$INPUT >down.R &&
118+
test $(flux R decode --count=node <down.R) -eq 0
119+
'
102120
test_expect_success 'create test input with properties' '
103121
cat <<-EOF >properties-test.in
104122
{

0 commit comments

Comments
 (0)