Skip to content

Commit

Permalink
tests: update golang tests and output
Browse files Browse the repository at this point in the history
Problem: a recent fix to reapi changed the output of the golang
bindings tests. This changed a value that was once static to a
value that changes with every run.

Use a sed command to remove this value from the output of the test.
Edited tests to use orelse_reserve flag.
  • Loading branch information
zekemorton committed Oct 31, 2023
1 parent d858045 commit 2b794f5
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion resource/reapi/bindings/go/src/test/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
func main() {
jgfPtr := flag.String("jgf", "", "path to jgf")
jobspecPtr := flag.String("jobspec", "", "path to jobspec")
reserve := flag.Bool("reserve", false, "or else reserve?")
reserve := flag.Bool("reserve", true, "or else reserve?")
flag.Parse()

jgf, err := os.ReadFile(*jgfPtr)
Expand Down
4 changes: 2 additions & 2 deletions t/data/resource/expected/golang/001.R.out
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ allocated: {"graph": {"nodes": [{"id": "43", "metadata": {"type": "core", "basen
at: 0
error: <nil>
Cancel output: <nil>
Info output jobid 1: false, 0, 0.000000, CANCELED, <nil>
Info output jobid 2: false, 0, 0.000000, <nil>
Info output jobid 1: false, 0, CANCELED, <nil>
Info output jobid 2: false, 0, <nil>
11 changes: 6 additions & 5 deletions t/data/resource/expected/golang/002.R.out
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ Errors so far:

----Match Allocate output---
jobid: 2
reserved: false
allocated:
at: 0
reserved: true
allocated: {"graph": {"nodes": [{"id": "21", "metadata": {"type": "core", "basename": "core", "name": "core13", "id": 13, "uniq_id": 21, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node0/socket0/core13"}}}, {"id": "22", "metadata": {"type": "core", "basename": "core", "name": "core14", "id": 14, "uniq_id": 22, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node0/socket0/core14"}}}, {"id": "23", "metadata": {"type": "core", "basename": "core", "name": "core15", "id": 15, "uniq_id": 23, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node0/socket0/core15"}}}, {"id": "24", "metadata": {"type": "core", "basename": "core", "name": "core16", "id": 16, "uniq_id": 24, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node0/socket0/core16"}}}, {"id": "25", "metadata": {"type": "core", "basename": "core", "name": "core17", "id": 17, "uniq_id": 25, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node0/socket0/core17"}}}, {"id": "80", "metadata": {"type": "gpu", "basename": "gpu", "name": "gpu0", "id": 0, "uniq_id": 80, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node0/socket0/gpu0"}}}, {"id": "85", "metadata": {"type": "memory", "basename": "memory", "name": "memory1", "id": 1, "uniq_id": 85, "rank": -1, "exclusive": true, "unit": "", "size": 2, "paths": {"containment": "/tiny0/rack0/node0/socket0/memory1"}}}, {"id": "86", "metadata": {"type": "memory", "basename": "memory", "name": "memory2", "id": 2, "uniq_id": 86, "rank": -1, "exclusive": true, "unit": "", "size": 2, "paths": {"containment": "/tiny0/rack0/node0/socket0/memory2"}}}, {"id": "87", "metadata": {"type": "memory", "basename": "memory", "name": "memory3", "id": 3, "uniq_id": 87, "rank": -1, "exclusive": true, "unit": "", "size": 2, "paths": {"containment": "/tiny0/rack0/node0/socket0/memory3"}}}, {"id": "4", "metadata": {"type": "socket", "basename": "socket", "name": "socket0", "id": 0, "uniq_id": 4, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node0/socket0"}}}, {"id": "39", "metadata": {"type": "core", "basename": "core", "name": "core31", "id": 31, "uniq_id": 39, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node0/socket1/core31"}}}, {"id": "40", "metadata": {"type": "core", "basename": "core", "name": "core32", "id": 32, "uniq_id": 40, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node0/socket1/core32"}}}, {"id": "41", "metadata": {"type": "core", "basename": "core", "name": "core33", "id": 33, "uniq_id": 41, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node0/socket1/core33"}}}, {"id": "42", "metadata": {"type": "core", "basename": "core", "name": "core34", "id": 34, "uniq_id": 42, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node0/socket1/core34"}}}, {"id": "43", "metadata": {"type": "core", "basename": "core", "name": "core35", "id": 35, "uniq_id": 43, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node0/socket1/core35"}}}, {"id": "81", "metadata": {"type": "gpu", "basename": "gpu", "name": "gpu1", "id": 1, "uniq_id": 81, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node0/socket1/gpu1"}}}, {"id": "89", "metadata": {"type": "memory", "basename": "memory", "name": "memory5", "id": 5, "uniq_id": 89, "rank": -1, "exclusive": true, "unit": "", "size": 2, "paths": {"containment": "/tiny0/rack0/node0/socket1/memory5"}}}, {"id": "90", "metadata": {"type": "memory", "basename": "memory", "name": "memory6", "id": 6, "uniq_id": 90, "rank": -1, "exclusive": true, "unit": "", "size": 2, "paths": {"containment": "/tiny0/rack0/node0/socket1/memory6"}}}, {"id": "91", "metadata": {"type": "memory", "basename": "memory", "name": "memory7", "id": 7, "uniq_id": 91, "rank": -1, "exclusive": true, "unit": "", "size": 2, "paths": {"containment": "/tiny0/rack0/node0/socket1/memory7"}}}, {"id": "5", "metadata": {"type": "socket", "basename": "socket", "name": "socket1", "id": 1, "uniq_id": 5, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node0/socket1"}}}, {"id": "2", "metadata": {"type": "node", "basename": "node", "name": "node0", "id": 0, "uniq_id": 2, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node0"}}}, {"id": "57", "metadata": {"type": "core", "basename": "core", "name": "core13", "id": 13, "uniq_id": 57, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node1/socket0/core13"}}}, {"id": "58", "metadata": {"type": "core", "basename": "core", "name": "core14", "id": 14, "uniq_id": 58, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node1/socket0/core14"}}}, {"id": "59", "metadata": {"type": "core", "basename": "core", "name": "core15", "id": 15, "uniq_id": 59, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node1/socket0/core15"}}}, {"id": "60", "metadata": {"type": "core", "basename": "core", "name": "core16", "id": 16, "uniq_id": 60, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node1/socket0/core16"}}}, {"id": "61", "metadata": {"type": "core", "basename": "core", "name": "core17", "id": 17, "uniq_id": 61, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node1/socket0/core17"}}}, {"id": "82", "metadata": {"type": "gpu", "basename": "gpu", "name": "gpu0", "id": 0, "uniq_id": 82, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node1/socket0/gpu0"}}}, {"id": "93", "metadata": {"type": "memory", "basename": "memory", "name": "memory1", "id": 1, "uniq_id": 93, "rank": -1, "exclusive": true, "unit": "", "size": 2, "paths": {"containment": "/tiny0/rack0/node1/socket0/memory1"}}}, {"id": "94", "metadata": {"type": "memory", "basename": "memory", "name": "memory2", "id": 2, "uniq_id": 94, "rank": -1, "exclusive": true, "unit": "", "size": 2, "paths": {"containment": "/tiny0/rack0/node1/socket0/memory2"}}}, {"id": "95", "metadata": {"type": "memory", "basename": "memory", "name": "memory3", "id": 3, "uniq_id": 95, "rank": -1, "exclusive": true, "unit": "", "size": 2, "paths": {"containment": "/tiny0/rack0/node1/socket0/memory3"}}}, {"id": "6", "metadata": {"type": "socket", "basename": "socket", "name": "socket0", "id": 0, "uniq_id": 6, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node1/socket0"}}}, {"id": "75", "metadata": {"type": "core", "basename": "core", "name": "core31", "id": 31, "uniq_id": 75, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node1/socket1/core31"}}}, {"id": "76", "metadata": {"type": "core", "basename": "core", "name": "core32", "id": 32, "uniq_id": 76, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node1/socket1/core32"}}}, {"id": "77", "metadata": {"type": "core", "basename": "core", "name": "core33", "id": 33, "uniq_id": 77, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node1/socket1/core33"}}}, {"id": "78", "metadata": {"type": "core", "basename": "core", "name": "core34", "id": 34, "uniq_id": 78, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node1/socket1/core34"}}}, {"id": "79", "metadata": {"type": "core", "basename": "core", "name": "core35", "id": 35, "uniq_id": 79, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node1/socket1/core35"}}}, {"id": "83", "metadata": {"type": "gpu", "basename": "gpu", "name": "gpu1", "id": 1, "uniq_id": 83, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node1/socket1/gpu1"}}}, {"id": "97", "metadata": {"type": "memory", "basename": "memory", "name": "memory5", "id": 5, "uniq_id": 97, "rank": -1, "exclusive": true, "unit": "", "size": 2, "paths": {"containment": "/tiny0/rack0/node1/socket1/memory5"}}}, {"id": "98", "metadata": {"type": "memory", "basename": "memory", "name": "memory6", "id": 6, "uniq_id": 98, "rank": -1, "exclusive": true, "unit": "", "size": 2, "paths": {"containment": "/tiny0/rack0/node1/socket1/memory6"}}}, {"id": "99", "metadata": {"type": "memory", "basename": "memory", "name": "memory7", "id": 7, "uniq_id": 99, "rank": -1, "exclusive": true, "unit": "", "size": 2, "paths": {"containment": "/tiny0/rack0/node1/socket1/memory7"}}}, {"id": "7", "metadata": {"type": "socket", "basename": "socket", "name": "socket1", "id": 1, "uniq_id": 7, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node1/socket1"}}}, {"id": "3", "metadata": {"type": "node", "basename": "node", "name": "node1", "id": 1, "uniq_id": 3, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node1"}}}, {"id": "1", "metadata": {"type": "rack", "basename": "rack", "name": "rack0", "id": 0, "uniq_id": 1, "rank": -1, "exclusive": false, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0"}}}, {"id": "0", "metadata": {"type": "cluster", "basename": "tiny", "name": "tiny0", "id": 0, "uniq_id": 0, "rank": -1, "exclusive": false, "unit": "", "size": 1, "paths": {"containment": "/tiny0"}}}], "edges": [{"source": "4", "target": "21", "metadata": {"name": {"containment": "contains"}}}, {"source": "4", "target": "22", "metadata": {"name": {"containment": "contains"}}}, {"source": "4", "target": "23", "metadata": {"name": {"containment": "contains"}}}, {"source": "4", "target": "24", "metadata": {"name": {"containment": "contains"}}}, {"source": "4", "target": "25", "metadata": {"name": {"containment": "contains"}}}, {"source": "4", "target": "80", "metadata": {"name": {"containment": "contains"}}}, {"source": "4", "target": "85", "metadata": {"name": {"containment": "contains"}}}, {"source": "4", "target": "86", "metadata": {"name": {"containment": "contains"}}}, {"source": "4", "target": "87", "metadata": {"name": {"containment": "contains"}}}, {"source": "2", "target": "4", "metadata": {"name": {"containment": "contains"}}}, {"source": "5", "target": "39", "metadata": {"name": {"containment": "contains"}}}, {"source": "5", "target": "40", "metadata": {"name": {"containment": "contains"}}}, {"source": "5", "target": "41", "metadata": {"name": {"containment": "contains"}}}, {"source": "5", "target": "42", "metadata": {"name": {"containment": "contains"}}}, {"source": "5", "target": "43", "metadata": {"name": {"containment": "contains"}}}, {"source": "5", "target": "81", "metadata": {"name": {"containment": "contains"}}}, {"source": "5", "target": "89", "metadata": {"name": {"containment": "contains"}}}, {"source": "5", "target": "90", "metadata": {"name": {"containment": "contains"}}}, {"source": "5", "target": "91", "metadata": {"name": {"containment": "contains"}}}, {"source": "2", "target": "5", "metadata": {"name": {"containment": "contains"}}}, {"source": "1", "target": "2", "metadata": {"name": {"containment": "contains"}}}, {"source": "6", "target": "57", "metadata": {"name": {"containment": "contains"}}}, {"source": "6", "target": "58", "metadata": {"name": {"containment": "contains"}}}, {"source": "6", "target": "59", "metadata": {"name": {"containment": "contains"}}}, {"source": "6", "target": "60", "metadata": {"name": {"containment": "contains"}}}, {"source": "6", "target": "61", "metadata": {"name": {"containment": "contains"}}}, {"source": "6", "target": "82", "metadata": {"name": {"containment": "contains"}}}, {"source": "6", "target": "93", "metadata": {"name": {"containment": "contains"}}}, {"source": "6", "target": "94", "metadata": {"name": {"containment": "contains"}}}, {"source": "6", "target": "95", "metadata": {"name": {"containment": "contains"}}}, {"source": "3", "target": "6", "metadata": {"name": {"containment": "contains"}}}, {"source": "7", "target": "75", "metadata": {"name": {"containment": "contains"}}}, {"source": "7", "target": "76", "metadata": {"name": {"containment": "contains"}}}, {"source": "7", "target": "77", "metadata": {"name": {"containment": "contains"}}}, {"source": "7", "target": "78", "metadata": {"name": {"containment": "contains"}}}, {"source": "7", "target": "79", "metadata": {"name": {"containment": "contains"}}}, {"source": "7", "target": "83", "metadata": {"name": {"containment": "contains"}}}, {"source": "7", "target": "97", "metadata": {"name": {"containment": "contains"}}}, {"source": "7", "target": "98", "metadata": {"name": {"containment": "contains"}}}, {"source": "7", "target": "99", "metadata": {"name": {"containment": "contains"}}}, {"source": "3", "target": "7", "metadata": {"name": {"containment": "contains"}}}, {"source": "1", "target": "3", "metadata": {"name": {"containment": "contains"}}}, {"source": "0", "target": "1", "metadata": {"name": {"containment": "contains"}}}]}}

at: 3600
error: <nil>
Cancel output: <nil>
Info output jobid 1: false, 0, 0.000000, CANCELED, <nil>
Info output jobid 2: false, 0, 0.000000, <nil>
Info output jobid 1: false, 0, CANCELED, <nil>
Info output jobid 2: true, 3600, <nil>
2 changes: 2 additions & 0 deletions t/t9001-golang-basic.t
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ main="../../resource/reapi/bindings/go/src/test/main"
test001_desc="match allocate 1 slot: 1 socket: 1 core (pol=default)"
test_expect_success "${test001_desc}" '
${main} --jgf=${jgf} --jobspec=${jobspec1} > 001.R.out &&
sed -i -E "s/, 0\.[0-9]+//g" 001.R.out &&
test_cmp 001.R.out ${exp_dir}/001.R.out
'

test002_desc="match allocate 2 slots: 2 sockets: 5 cores 1 gpu 6 memory"
test_expect_success "${test002_desc}" '
${main} --jgf=${jgf} --jobspec=${jobspec2} > 002.R.out &&
sed -i -E "s/, 0\.[0-9]+//g" 002.R.out &&
test_cmp 002.R.out ${exp_dir}/002.R.out
'

Expand Down

0 comments on commit 2b794f5

Please sign in to comment.