Skip to content

Commit

Permalink
tests: add tests for rq2
Browse files Browse the repository at this point in the history
Problem: rq2 needs tests to verify that it can be a drop in
replacement for rq1

Add some simple tests for current functionality. Generate the
expected files using rq1
  • Loading branch information
zekemorton committed Dec 14, 2023
1 parent 6c7ca2e commit 922b6dc
Show file tree
Hide file tree
Showing 6 changed files with 144 additions and 0 deletions.
1 change: 1 addition & 0 deletions t/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ set(ALL_TESTS
t3033-resource-nodex.t
t3034-resource-pconstraints.t
t3035-resource-remove.t
t3036-rq2.t
t3300-system-dontblock.t
t3301-system-latestart.t
t4000-match-params.t
Expand Down
6 changes: 6 additions & 0 deletions t/data/resource/commands/rq2/cmds01.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
match allocate @TEST_SRCDIR@/data/resource/jobspecs/basics/test001.yaml
match allocate @TEST_SRCDIR@/data/resource/jobspecs/basics/test001.yaml
match allocate @TEST_SRCDIR@/data/resource/jobspecs/basics/test001.yaml
match allocate @TEST_SRCDIR@/data/resource/jobspecs/basics/test001.yaml
match allocate @TEST_SRCDIR@/data/resource/jobspecs/basics/test001.yaml
quit
7 changes: 7 additions & 0 deletions t/data/resource/commands/rq2/cmds02.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
match allocate_orelse_reserve @TEST_SRCDIR@/data/resource/jobspecs/basics/test001.yaml
match allocate_orelse_reserve @TEST_SRCDIR@/data/resource/jobspecs/basics/test001.yaml
match allocate_orelse_reserve @TEST_SRCDIR@/data/resource/jobspecs/basics/test001.yaml
match allocate_orelse_reserve @TEST_SRCDIR@/data/resource/jobspecs/basics/test001.yaml
match allocate_orelse_reserve @TEST_SRCDIR@/data/resource/jobspecs/basics/test001.yaml
match allocate @TEST_SRCDIR@/data/resource/jobspecs/basics/test001.yaml
quit
44 changes: 44 additions & 0 deletions t/data/resource/expected/rq2/001.R.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---------------core35[1:x]
------------socket1[1:x]
---------node1[1:s]
------rack0[1:s]
---tiny0[1:s]
INFO: =============================
INFO: JOBID=1
INFO: RESOURCES=ALLOCATED
INFO: SCHEDULED AT=Now
INFO: =============================
---------------core35[1:x]
------------socket1[1:x]
---------node0[1:s]
------rack0[1:s]
---tiny0[1:s]
INFO: =============================
INFO: JOBID=2
INFO: RESOURCES=ALLOCATED
INFO: SCHEDULED AT=Now
INFO: =============================
---------------core17[1:x]
------------socket0[1:x]
---------node1[1:s]
------rack0[1:s]
---tiny0[1:s]
INFO: =============================
INFO: JOBID=3
INFO: RESOURCES=ALLOCATED
INFO: SCHEDULED AT=Now
INFO: =============================
---------------core17[1:x]
------------socket0[1:x]
---------node0[1:s]
------rack0[1:s]
---tiny0[1:s]
INFO: =============================
INFO: JOBID=4
INFO: RESOURCES=ALLOCATED
INFO: SCHEDULED AT=Now
INFO: =============================
INFO: =============================
INFO: No matching resources found
INFO: JOBID=5
INFO: =============================
54 changes: 54 additions & 0 deletions t/data/resource/expected/rq2/002.R.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---------------core35[1:x]
------------socket1[1:x]
---------node1[1:s]
------rack0[1:s]
---tiny0[1:s]
INFO: =============================
INFO: JOBID=1
INFO: RESOURCES=ALLOCATED
INFO: SCHEDULED AT=Now
INFO: =============================
---------------core35[1:x]
------------socket1[1:x]
---------node0[1:s]
------rack0[1:s]
---tiny0[1:s]
INFO: =============================
INFO: JOBID=2
INFO: RESOURCES=ALLOCATED
INFO: SCHEDULED AT=Now
INFO: =============================
---------------core17[1:x]
------------socket0[1:x]
---------node1[1:s]
------rack0[1:s]
---tiny0[1:s]
INFO: =============================
INFO: JOBID=3
INFO: RESOURCES=ALLOCATED
INFO: SCHEDULED AT=Now
INFO: =============================
---------------core17[1:x]
------------socket0[1:x]
---------node0[1:s]
------rack0[1:s]
---tiny0[1:s]
INFO: =============================
INFO: JOBID=4
INFO: RESOURCES=ALLOCATED
INFO: SCHEDULED AT=Now
INFO: =============================
---------------core35[1:x]
------------socket1[1:x]
---------node1[1:s]
------rack0[1:s]
---tiny0[1:s]
INFO: =============================
INFO: JOBID=5
INFO: RESOURCES=RESERVED
INFO: SCHEDULED AT=3600
INFO: =============================
INFO: =============================
INFO: No matching resources found
INFO: JOBID=6
INFO: =============================
32 changes: 32 additions & 0 deletions t/t3036-rq2.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/sh

test_description='Test resource graph remove subgraph'

. $(dirname $0)/sharness.sh

cmd_dir="${SHARNESS_TEST_SRCDIR}/data/resource/commands/rq2"
exp_dir="${SHARNESS_TEST_SRCDIR}/data/resource/expected/rq2"
jgf="${SHARNESS_TEST_SRCDIR}/data/resource/jgfs/tiny.json"
query="../../resource/utilities/rq2"

cmds001="${cmd_dir}/cmds01.in"
test001_desc="match allocate test"
test_expect_success "${test001_desc}" '
sed "s~@TEST_SRCDIR@~${SHARNESS_TEST_SRCDIR}~g" ${cmds001} > cmds001 &&
${query} -L ${jgf} -f jgf -t 001.R.out \
< cmds001 &&
test_cmp 001.R.out ${exp_dir}/001.R.out
'

cmds002="${cmd_dir}/cmds02.in"
test002_desc="match allocate_orelse_reserve test"
test_expect_success "${test002_desc}" '
sed "s~@TEST_SRCDIR@~${SHARNESS_TEST_SRCDIR}~g" ${cmds002} > cmds002 &&
${query} -L ${jgf} -f jgf -t 002.R.out \
< cmds002 &&
test_cmp 002.R.out ${exp_dir}/002.R.out
'



test_done

0 comments on commit 922b6dc

Please sign in to comment.