Skip to content

Commit 059bea4

Browse files
committed
testsuite: setup fake hostnames for job list tests
Problem: In the near future we would like to filter jobs based on nodes in a job's nodelist. This would be an issue in the current test setup because test brokers all run under the same host and it is unknown which nodes jobs actually ran on. Solution: Setup fake hostnames for the test brokers in t2260-job-list.t and when necessary, run test jobs on specific hosts.
1 parent b75cbb0 commit 059bea4

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

t/t2260-job-list.t

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,15 @@ wait_jobid_state() {
2525
flux job list-ids --wait-state=$2 $1 > /dev/null
2626
}
2727

28+
test_expect_success 'setup specific fake hostnames' '
29+
flux R encode -r 0-3 -c 0-1 -H node[0-3] \
30+
| tr -d "\n" \
31+
| flux kvs put -r resource.R=- &&
32+
flux module unload sched-simple &&
33+
flux module reload resource noverify &&
34+
flux module load sched-simple
35+
'
36+
2837
test_expect_success 'create helper job submission script' '
2938
cat >sleepinf.sh <<-EOT &&
3039
#!/bin/sh
@@ -56,7 +65,7 @@ test_expect_success 'submit jobs for job list testing' '
5665
# submit jobs that will complete
5766
#
5867
for i in $(seq 0 3); do
59-
flux submit hostname >> inactiveids
68+
flux submit --requires=host:node${i} hostname >> inactiveids
6069
fj_wait_event `tail -n 1 inactiveids` clean
6170
done &&
6271
#
@@ -67,7 +76,7 @@ test_expect_success 'submit jobs for job list testing' '
6776
# Run a job that will fail, copy its JOBID to both inactive and
6877
# failed lists.
6978
#
70-
! jobid=`flux submit --wait nosuchcommand` &&
79+
! jobid=`flux submit --requires=host:node0 --wait nosuchcommand` &&
7180
echo $jobid >> inactiveids &&
7281
flux job id $jobid > failedids &&
7382
#
@@ -77,7 +86,7 @@ test_expect_success 'submit jobs for job list testing' '
7786
# N.B. sleepinf.sh and wait-event on job data to workaround
7887
# rare job startup race. See #5210
7988
#
80-
jobid=`flux submit ./sleepinf.sh` &&
89+
jobid=`flux submit --requires=host:node0 ./sleepinf.sh` &&
8190
flux job wait-event -W -p guest.output $jobid data &&
8291
flux job kill $jobid &&
8392
fj_wait_event $jobid clean &&
@@ -91,7 +100,7 @@ test_expect_success 'submit jobs for job list testing' '
91100
# N.B. sleepinf.sh and wait-event on job data to workaround
92101
# rare job startup race. See #5210
93102
#
94-
jobid=`flux submit ./sleepinf.sh` &&
103+
jobid=`flux submit --requires=host:node0 ./sleepinf.sh` &&
95104
flux job wait-event -W -p guest.output $jobid data &&
96105
flux job raise --type=myexception --severity=0 -m "myexception" $jobid &&
97106
fj_wait_event $jobid clean &&
@@ -102,20 +111,25 @@ test_expect_success 'submit jobs for job list testing' '
102111
# Run a job that will timeout, copy its JOBID to both inactive and
103112
# timeout lists.
104113
#
105-
jobid=`flux submit --time-limit=0.5s sleep 30` &&
114+
jobid=`flux submit --requires=host:node0 --time-limit=0.5s sleep 30` &&
106115
echo $jobid >> inactiveids &&
107116
flux job id $jobid > timeout.ids &&
108117
fj_wait_event ${jobid} clean &&
109118
#
110119
# Submit 8 sleep jobs to fill up resources
111120
#
121+
# N.B. no need to specify --requires:host, will be distributed
122+
# evenly
123+
#
112124
for i in $(seq 0 7); do
113125
flux submit --time-limit=5m sleep 600 >> runningids
114126
done &&
115127
tac runningids | flux job id > running.ids &&
116128
#
117129
# Submit a set of jobs with misc urgencies
118130
#
131+
# N.B. no need to specify --requires:host, these jobs wont run
132+
#
119133
id1=$(flux submit --urgency=20 hostname) &&
120134
id2=$(flux submit hostname) &&
121135
id3=$(flux submit --urgency=31 hostname) &&

0 commit comments

Comments
 (0)