Skip to content

Commit

Permalink
test: update dws2jgf tests to use rabbit mapping
Browse files Browse the repository at this point in the history
Problem: tests for the flux-dws2jgf script need to be updated now
that the script reads from a mapping generated by flux-rabbitmapping
instead of by polling kubernetes.

Change the tests and add a simple test for flux-rabbitmapping.
  • Loading branch information
jameshcorbett committed Aug 31, 2024
1 parent beef4ba commit aa480c0
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 8 deletions.
18 changes: 18 additions & 0 deletions t/data/dws2jgf/rabbits.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"computes": {
"compute-01": "kind-worker2",
"compute-02": "kind-worker2",
"compute-03": "kind-worker2",
"compute-04": "kind-worker3"
},
"rabbits": {
"kind-worker2": {
"capacity": 39582418599936,
"hostlist": "compute-[01-03]"
},
"kind-worker3": {
"capacity": 39582418599936,
"hostlist": "compute-04"
}
}
}
3 changes: 2 additions & 1 deletion t/t1002-dws-workflow-obj.t
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,9 @@ test_expect_success 'job submission with valid DW string works with fluxion-rabb

test_expect_success 'load fluxion with rabbits' '
flux cancel ${DWS_JOBID} &&
flux python ${FLUX_SOURCE_DIR}/src/cmd/flux-rabbitmapping.py > rabbits.json &&
flux R encode -l | flux python ${FLUX_SOURCE_DIR}/src/cmd/flux-dws2jgf.py \
--no-validate | jq . > R.local &&
--no-validate rabbits.json | jq . > R.local &&
flux kvs put resource.R="$(cat R.local)" &&
flux module remove -f sched-fluxion-qmanager &&
flux module remove -f sched-fluxion-resource &&
Expand Down
5 changes: 3 additions & 2 deletions t/t1003-dws-nnf-watch.t
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ test_expect_success 'job-manager: load alloc-bypass plugin' '

test_expect_success 'load Fluxion with rabbit resource graph' '
echo $PYTHONPATH >&2 &&
flux python ${FLUX_SOURCE_DIR}/src/cmd/flux-rabbitmapping.py > rabbits.json &&
flux R encode -l | flux python ${FLUX_SOURCE_DIR}/src/cmd/flux-dws2jgf.py \
--no-validate | jq . > R.local &&
--no-validate rabbits.json | jq . > R.local &&
flux kvs put resource.R="$(cat R.local)" &&
flux module remove -f sched-fluxion-qmanager &&
flux module remove -f sched-fluxion-resource &&
Expand Down Expand Up @@ -172,7 +173,7 @@ test_expect_success 'exec Storage watching script with invalid --drain-queues ar
test_expect_success 'configure flux with queues' '
flux R encode -l | jq ".execution.properties.debug = \"0\"" | \
flux python ${FLUX_SOURCE_DIR}/src/cmd/flux-dws2jgf.py \
--no-validate | jq . > R.local.queues &&
--no-validate rabbits.json | jq . > R.local.queues &&
flux kvs put resource.R="$(cat R.local.queues)" &&
flux module remove -f sched-fluxion-qmanager &&
flux module remove -f sched-fluxion-resource &&
Expand Down
16 changes: 11 additions & 5 deletions t/t2000-dws2jgf.t
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,32 @@ test_expect_success HAVE_JQ 'smoke test to ensure the storage resources are expe
test $(hostname) = compute-01
'

test_expect_success HAVE_JQ 'flux-rabbitmapping outputs expected mapping' '
flux python ${FLUX_SOURCE_DIR}/src/cmd/flux-rabbitmapping.py -i2 > rabbits.json
test_cmp ${DATADIR}/rabbits.json rabbits.json
'

test_expect_success HAVE_JQ 'flux-dws2jgf.py outputs expected JGF for single compute node' '
flux R encode -Hcompute-01 | flux python ${CMD} --no-validate --cluster-name=ElCapitan \
| jq . > actual-compute-01.jgf &&
rabbits.json | jq . > actual-compute-01.jgf &&
test_cmp ${DATADIR}/expected-compute-01.jgf actual-compute-01.jgf
'

test_expect_success HAVE_JQ 'flux-dws2jgf.py outputs expected JGF for multiple compute nodes' '
flux R encode -Hcompute-[01-04] -c0-4 | flux python ${CMD} --no-validate --cluster-name=ElCapitan \
| jq . > actual-compute-01-04.jgf &&
rabbits.json | jq . > actual-compute-01-04.jgf &&
test_cmp ${DATADIR}/expected-compute-01-04.jgf actual-compute-01-04.jgf
'

test_expect_success HAVE_JQ 'flux-dws2jgf.py outputs expected JGF for compute nodes not in DWS' '
flux R encode -Hcompute-[01-04],nodws[0-5] -c0-4 | \
flux python ${CMD} --no-validate | jq . > actual-compute-01-nodws.jgf &&
flux python ${CMD} --no-validate rabbits.json | jq . > actual-compute-01-nodws.jgf &&
test_cmp ${DATADIR}/expected-compute-01-nodws.jgf actual-compute-01-nodws.jgf
'

test_expect_success HAVE_JQ 'flux-dws2jgf.py handles properties correctly' '
cat ${DATADIR}/R-properties | \
flux python ${CMD} --no-validate | jq . > actual-properties.jgf &&
flux python ${CMD} --no-validate rabbits.json | jq . > actual-properties.jgf &&
test_cmp ${DATADIR}/expected-properties.jgf actual-properties.jgf
'

Expand All @@ -70,7 +75,8 @@ test_expect_success HAVE_JQ 'fluxion rejects a rack/rabbit job when no rabbits a

test_expect_success HAVE_JQ 'fluxion can be loaded with output of dws2jgf' '
flux run -n1 hostname &&
flux R encode -l | flux python ${CMD} --no-validate --cluster-name=ElCapitan | jq . > R.local &&
flux R encode -l | flux python ${CMD} --no-validate --cluster-name=ElCapitan rabbits.json \
| jq . > R.local &&
flux kvs put resource.R="$(cat R.local)" &&
flux module list &&
flux module remove -f sched-fluxion-qmanager &&
Expand Down

0 comments on commit aa480c0

Please sign in to comment.