Files
self ccfbd156e7 fix: isolate grouped scenario runs
Run alias group scenarios with separate generated run IDs instead of sharing one provider-resource namespace. Apply kept-node behavior in group mode only to failing scenarios and the final successful scenario so successful intermediates are cleaned up.
2026-06-18 05:06:44 +02:00

50 lines
1.4 KiB
TypeScript

import assert from "node:assert/strict"
import test from "node:test"
import { resolveGroupScenarioConfig, resolveGroupScenarioRunOptions } from "../src/index.js"
test("group scenarios get distinct generated run metadata", () => {
const env = {
LEGION_UNLOCK_PASSWORD: "unlock-secret"
}
const now = new Date("2026-04-09T12:34:56.000Z")
const first = resolveGroupScenarioConfig(
"single-node-init",
0,
env,
"/workspace/tribes-supertest",
now
)
const second = resolveGroupScenarioConfig(
"cluster-plugin-integrated-rollout",
1,
env,
"/workspace/tribes-supertest",
now
)
assert.notEqual(first.runId, second.runId)
assert.notEqual(first.nodeNamePrefix, second.nodeNamePrefix)
assert.equal(
first.artifactRootDir,
"/workspace/tribes-supertest/.state/supertest/2026-04-09t123456000z-single-node-init"
)
assert.equal(
second.artifactRootDir,
"/workspace/tribes-supertest/.state/supertest/2026-04-09t123456001z-cluster-plugin-integrated-rollout"
)
})
test("group keep nodes applies to failures and the last successful scenario only", () => {
assert.deepEqual(resolveGroupScenarioRunOptions(0, 3, false), {})
assert.deepEqual(resolveGroupScenarioRunOptions(0, 3, true), {
keepNodesOnSuccess: false,
keepNodesOnFailure: true
})
assert.deepEqual(resolveGroupScenarioRunOptions(2, 3, true), {
keepNodesOnSuccess: true,
keepNodesOnFailure: true
})
})