mirror of
https://github.com/affaan-m/ECC.git
synced 2026-09-12 04:37:54 +02:00
test: reject empty qualification nodes
This commit is contained in:
+5
-2
@@ -86,7 +86,7 @@ function requiredOptionValue(args, option) {
|
||||
throw new Error(`${option} is required exactly once for live node qualification.`);
|
||||
}
|
||||
const value = args[indexes[0] + 1];
|
||||
if (!value || value.startsWith("--")) {
|
||||
if (!value?.trim() || value.startsWith("--")) {
|
||||
throw new Error(`${option} requires a non-empty value for live node qualification.`);
|
||||
}
|
||||
return value;
|
||||
@@ -104,7 +104,10 @@ function validateNodeQualificationArgs(args, environment) {
|
||||
);
|
||||
}
|
||||
requiredOptionValue(args, "--cluster");
|
||||
requiredOptionValue(args, "--nodes");
|
||||
const nodes = requiredOptionValue(args, "--nodes");
|
||||
if (!nodes.split(",").every((node) => node.trim().length > 0)) {
|
||||
throw new Error("--nodes must explicitly list one or more non-empty nodes.");
|
||||
}
|
||||
const configDirectory = requiredOptionValue(args, "--config-dir");
|
||||
if (!path.isAbsolute(configDirectory)) {
|
||||
throw new Error("--config-dir must be an existing absolute directory.");
|
||||
|
||||
@@ -243,6 +243,18 @@ function main() {
|
||||
env: { ITO_ENABLE_SIXTYTWO_LIVE: "1" },
|
||||
error: /--nodes/,
|
||||
},
|
||||
{
|
||||
label: "empty node list",
|
||||
args: [
|
||||
"ito", "evals",
|
||||
"--cluster", "clu_prod_example",
|
||||
"--live-sixtytwo",
|
||||
"--nodes", ",",
|
||||
"--config-dir", "__CONFIG__",
|
||||
],
|
||||
env: { ITO_ENABLE_SIXTYTWO_LIVE: "1" },
|
||||
error: /--nodes/,
|
||||
},
|
||||
{
|
||||
label: "missing cluster",
|
||||
args: [
|
||||
|
||||
Reference in New Issue
Block a user