Skip to content

Commit fc2aece

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 68165f8 commit fc2aece

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
@@ -26,6 +26,15 @@ wait_jobid_state() {
2626
flux job list-ids --wait-state=$2 $1 > /dev/null
2727
}
2828

29+
test_expect_success 'setup specific fake hostnames' '
30+
flux R encode -r 0-3 -c 0-1 -H node[0-3] \
31+
| tr -d "\n" \
32+
| flux kvs put -r resource.R=- &&
33+
flux module unload sched-simple &&
34+
flux module reload resource noverify &&
35+
flux module load sched-simple
36+
'
37+
2938
test_expect_success 'create helper job submission script' '
3039
cat >sleepinf.sh <<-EOT &&
3140
#!/bin/sh
@@ -57,7 +66,7 @@ test_expect_success 'submit jobs for job list testing' '
5766
# submit jobs that will complete
5867
#
5968
for i in $(seq 0 3); do
60-
flux submit hostname >> inactiveids
69+
flux submit --requires=host:node${i} hostname >> inactiveids
6170
fj_wait_event `tail -n 1 inactiveids` clean
6271
done &&
6372
#
@@ -68,7 +77,7 @@ test_expect_success 'submit jobs for job list testing' '
6877
# Run a job that will fail, copy its JOBID to both inactive and
6978
# failed lists.
7079
#
71-
! jobid=`flux submit --wait nosuchcommand` &&
80+
! jobid=`flux submit --requires=host:node0 --wait nosuchcommand` &&
7281
echo $jobid >> inactiveids &&
7382
flux job id $jobid > failedids &&
7483
#
@@ -78,7 +87,7 @@ test_expect_success 'submit jobs for job list testing' '
7887
# N.B. sleepinf.sh and wait-event on job data to workaround
7988
# rare job startup race. See #5210
8089
#
81-
jobid=`flux submit ./sleepinf.sh` &&
90+
jobid=`flux submit --requires=host:node0 ./sleepinf.sh` &&
8291
flux job wait-event -W -p guest.output $jobid data &&
8392
flux job kill $jobid &&
8493
fj_wait_event $jobid clean &&
@@ -92,7 +101,7 @@ test_expect_success 'submit jobs for job list testing' '
92101
# N.B. sleepinf.sh and wait-event on job data to workaround
93102
# rare job startup race. See #5210
94103
#
95-
jobid=`flux submit ./sleepinf.sh` &&
104+
jobid=`flux submit --requires=host:node0 ./sleepinf.sh` &&
96105
flux job wait-event -W -p guest.output $jobid data &&
97106
flux job raise --type=myexception --severity=0 -m "myexception" $jobid &&
98107
fj_wait_event $jobid clean &&
@@ -103,20 +112,25 @@ test_expect_success 'submit jobs for job list testing' '
103112
# Run a job that will timeout, copy its JOBID to both inactive and
104113
# timeout lists.
105114
#
106-
jobid=`flux submit --time-limit=0.5s sleep 30` &&
115+
jobid=`flux submit --requires=host:node0 --time-limit=0.5s sleep 30` &&
107116
echo $jobid >> inactiveids &&
108117
flux job id $jobid > timeout.ids &&
109118
fj_wait_event ${jobid} clean &&
110119
#
111120
# Submit 8 sleep jobs to fill up resources
112121
#
122+
# N.B. no need to specify --requires:host, will be distributed
123+
# evenly
124+
#
113125
for i in $(seq 0 7); do
114126
flux submit --time-limit=5m sleep 600 >> runningids
115127
done &&
116128
tac runningids | flux job id > running.ids &&
117129
#
118130
# Submit a set of jobs with misc urgencies
119131
#
132+
# N.B. no need to specify --requires:host, these jobs wont run
133+
#
120134
id1=$(flux submit --urgency=20 hostname) &&
121135
id2=$(flux submit hostname) &&
122136
id3=$(flux submit --urgency=31 hostname) &&

0 commit comments

Comments
 (0)