Skip to content

Commit c2ad355

Browse files
committed
testsuite: test resource.config in t2315-resource-system.t
Problem: None of the resource module tests use the resource.config array for testing. Add a couple tests that ensure the Flux resource module can be configured via the resource.config array instead of a path to an R.
1 parent 4577ef3 commit c2ad355

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

t/t2315-resource-system.t

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,4 +142,49 @@ test_expect_success HAVE_JQ,MULTICORE 'resource norestrict option works' '
142142
test $(cat ${name}/ncores) = $NCORES
143143
'
144144

145+
test_expect_success 'resources can be configured in TOML' '
146+
name=conftest &&
147+
mkdir -p $name &&
148+
cat >${name}/resource.toml <<-EOF &&
149+
[resource]
150+
noverify = true
151+
[[resource.config]]
152+
hosts = "foo[0-10]"
153+
cores = "0-3"
154+
[[resource.config]]
155+
hosts = "foo[9,10]"
156+
gpus = "0-1"
157+
[[resource.config]]
158+
hosts = "foo[0-2]"
159+
properties = ["debug"]
160+
[[resource.config]]
161+
hosts = "foo[3-10]"
162+
properties = ["batch"]
163+
EOF
164+
flux start -s 1 \
165+
-o,--config-path=$(pwd)/${name},-Slog-filename=${name}/logfile \
166+
flux resource list -s up > ${name}/output &&
167+
test_debug "cat ${name}/output" &&
168+
cat <<-EOF >${name}/expected &&
169+
STATE PROPERTIES NNODES NCORES NGPUS NODELIST
170+
up debug 3 12 0 foo[0-2]
171+
up batch 8 32 4 foo[3-10]
172+
EOF
173+
test_cmp ${name}/expected ${name}/output
174+
'
175+
test_expect_success 'bad resource.config causes instance failure' '
176+
name=conftest-bad &&
177+
mkdir -p ${name} &&
178+
cat >${name}/resource.toml <<-EOF &&
179+
[resource]
180+
noverify = true
181+
config = []
182+
EOF
183+
test_must_fail flux start -s 1 \
184+
-o,--config-path=$(pwd)/${name},-Slog-filename=${name}/logfile \
185+
flux resource list -s up > ${name}/output 2>&1 &&
186+
test_debug "cat ${name}/output" &&
187+
grep "no hosts configured" ${name}/output
188+
'
189+
145190
test_done

0 commit comments

Comments
 (0)