Skip to content

Commit eb0bc8a

Browse files
committed
test: add tests for resource.set-status rpc
Problem: there are no tests to ensure that the "sched-fluxion-resource.set_status" service works properly. Add tests.
1 parent 373018b commit eb0bc8a

File tree

3 files changed

+86
-0
lines changed

3 files changed

+86
-0
lines changed

t/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ set(ALL_TESTS
7777
t4009-match-update.t
7878
t4010-match-conf.t
7979
t4011-match-duration.t
80+
t4012-set-status.t
8081
t5000-valgrind.t
8182
t6000-graph-size.t
8283
t6001-match-formats.t

t/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ TESTS = \
9595
t4009-match-update.t \
9696
t4010-match-conf.t \
9797
t4011-match-duration.t \
98+
t4012-set-status.t \
9899
t5000-valgrind.t \
99100
t5100-issues-test-driver.t \
100101
t6000-graph-size.t \

t/t4012-set-status.t

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
#!/bin/sh
2+
#set -x
3+
4+
test_description='Test the basic functionality of properties (get/set) within resource
5+
'
6+
7+
. `dirname $0`/sharness.sh
8+
9+
grug="${SHARNESS_TEST_SRCDIR}/data/resource/grugs/tiny.graphml"
10+
jobspec="${SHARNESS_TEST_SRCDIR}/data/resource/jobspecs/basics/test008.yaml"
11+
12+
#
13+
# test_under_flux is under sharness.d/
14+
#
15+
test_under_flux 1
16+
17+
#
18+
# print only with --debug
19+
#
20+
21+
test_debug '
22+
echo ${grug}
23+
'
24+
25+
test_expect_success 'loading resource module with a tiny machine config works' '
26+
load_resource \
27+
load-file=${grug} load-format=grug \
28+
prune-filters=ALL:core subsystems=containment policy=high
29+
'
30+
31+
test_expect_success 'set-status basic test works' '
32+
flux ion-resource find status=down | grep null &&
33+
flux ion-resource set-status /tiny0/rack0/node0 down &&
34+
flux ion-resource find status=down | grep node0 &&
35+
flux ion-resource set-status /tiny0/rack0/node0 up &&
36+
flux ion-resource find status=down | grep null
37+
'
38+
39+
test_expect_success 'bad resource path produces an error' '
40+
test_must_fail flux ion-resource set-status /foobar/not/a/vertex down
41+
'
42+
43+
test_expect_success 'bad status produces an error' '
44+
test_must_fail flux ion-resource set-status /tiny0/rack0/node0 foobar
45+
'
46+
47+
test_expect_success 'set-status not-so-basic test works' '
48+
flux ion-resource find status=down | grep null &&
49+
flux ion-resource set-status /tiny0/rack0/node0 down &&
50+
flux ion-resource find status=down | grep node0 &&
51+
flux ion-resource set-status /tiny0/rack0/node1 down &&
52+
flux ion-resource find status=down | grep "node\[0-1\]" &&
53+
flux ion-resource set-status /tiny0/rack0/node0 up &&
54+
flux ion-resource find status=down | grep node1 &&
55+
flux ion-resource set-status /tiny0/rack0/node1 up &&
56+
flux ion-resource find status=down | grep null
57+
'
58+
59+
test_expect_success 'jobs fail when all nodes are marked down' '
60+
flux ion-resource set-status /tiny0/rack0/node0 down &&
61+
flux ion-resource set-status /tiny0/rack0/node1 down &&
62+
flux ion-resource find status=up | grep null &&
63+
flux ion-resource match satisfiability $jobspec &&
64+
test_must_fail flux ion-resource match allocate $jobspec &&
65+
flux ion-resource set-status /tiny0/rack0/node0 up &&
66+
flux ion-resource set-status /tiny0/rack0/node1 up &&
67+
flux ion-resource find status=down | grep null
68+
'
69+
70+
test_expect_success 'jobs fail when all racks are marked down' '
71+
flux ion-resource find status=down | grep null &&
72+
flux ion-resource set-status /tiny0/rack0 down &&
73+
flux ion-resource find status=up | grep null &&
74+
flux ion-resource match satisfiability $jobspec &&
75+
test_must_fail flux ion-resource match allocate $jobspec &&
76+
flux ion-resource set-status /tiny0/rack0 up &&
77+
flux ion-resource find status=down | grep null
78+
'
79+
80+
test_expect_success 'removing resource works' '
81+
remove_resource
82+
'
83+
84+
test_done

0 commit comments

Comments
 (0)