Skip to content

Commit e925dff

Browse files
authored
Merge pull request #6186 from grondo/exclude-error
resource: error message cleanup, add test for invalid exclude
2 parents 74ff7b6 + 21c1498 commit e925dff

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

src/modules/resource/exclude.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,11 @@ struct exclude *exclude_create (struct resource_ctx *ctx,
6464
if (!(exclude->idset = inventory_targets_to_ranks (ctx->inventory,
6565
exclude_idset,
6666
&error))) {
67-
flux_log_error (ctx->h,
68-
"error decoding exclude set %s: %s",
69-
exclude_idset,
70-
error.text);
67+
flux_log (ctx->h,
68+
LOG_ERR,
69+
"error decoding exclude set %s: %s",
70+
exclude_idset,
71+
error.text);
7172
goto error;
7273
}
7374
if (idset_count (exclude->idset) > 0

t/t2312-resource-exclude.t

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,5 +97,19 @@ test_expect_success 'instance with configured R can exclude hostnames' '
9797
test $(flux start -s1 -o,--config-path=exclude3.toml \
9898
flux resource status -s exclude -no {nnodes}) -eq 1
9999
'
100+
test_expect_success 'incorrect excluded hostnames raises correct error' '
101+
cat >exclude4.toml <<-EOT &&
102+
[resource]
103+
exclude = "badhost"
104+
noverify = true
105+
[[resource.config]]
106+
hosts = "$(hostname -s)"
107+
cores = "0"
108+
EOT
109+
test_must_fail flux start -o,--config-path=exclude4.toml true \
110+
2>exclude4.err &&
111+
test_debug "cat exclude4.err" &&
112+
grep "invalid hosts: badhost" exclude4.err
113+
'
100114

101115
test_done

t/t2315-resource-system.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ test_expect_success 'invalid exclude hosts cause instance failure' '
107107
test_must_fail flux start -s 2 \
108108
-o,--config-path=$(pwd)/${name},-Slog-filename=${name}/logfile \
109109
flux resource list -s up -no {nnodes} > ${name}/nnodes &&
110-
grep "nosuchhost: Invalid argument" ${name}/logfile
110+
grep "invalid hosts: nosuchhost" ${name}/logfile
111111
'
112112

113113
test_expect_success 'gpu resources in configured R are not verified' '

0 commit comments

Comments
 (0)