mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 17:10:49 +00:00
test(e2e): expand published upgrade survivor baselines
This commit is contained in:
@@ -351,6 +351,39 @@ describe("scripts/lib/docker-e2e-plan", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("expands the published upgrade survivor lane across deduped baselines", () => {
|
||||
const plan = planFor({
|
||||
selectedLaneNames: ["published-upgrade-survivor"],
|
||||
upgradeSurvivorBaselines:
|
||||
"openclaw@2026.4.29 2026.4.23 openclaw@2026.4.23 openclaw@2026.3.13-1",
|
||||
});
|
||||
|
||||
expect(plan.lanes.map((lane) => lane.name)).toEqual([
|
||||
"published-upgrade-survivor-2026.4.29",
|
||||
"published-upgrade-survivor-2026.4.23",
|
||||
"published-upgrade-survivor-2026.3.13-1",
|
||||
]);
|
||||
expect(plan.lanes).toEqual([
|
||||
expect.objectContaining({
|
||||
command: expect.stringContaining(
|
||||
"OPENCLAW_UPGRADE_SURVIVOR_BASELINE_SPEC='openclaw@2026.4.29'",
|
||||
),
|
||||
imageKind: "bare",
|
||||
stateScenario: "upgrade-survivor",
|
||||
}),
|
||||
expect.objectContaining({
|
||||
command: expect.stringContaining(
|
||||
"OPENCLAW_UPGRADE_SURVIVOR_BASELINE_SPEC='openclaw@2026.4.23'",
|
||||
),
|
||||
}),
|
||||
expect.objectContaining({
|
||||
command: expect.stringContaining(
|
||||
"OPENCLAW_UPGRADE_SURVIVOR_BASELINE_SPEC='openclaw@2026.3.13-1'",
|
||||
),
|
||||
}),
|
||||
]);
|
||||
});
|
||||
|
||||
it("plans a live-only selected lane without package e2e images", () => {
|
||||
const plan = planFor({ selectedLaneNames: ["live-models"] });
|
||||
|
||||
|
||||
@@ -42,6 +42,11 @@ describe("package acceptance workflow", () => {
|
||||
|
||||
expect(workflow).toContain("suite_profile:");
|
||||
expect(workflow).toContain("published_upgrade_survivor_baseline:");
|
||||
expect(workflow).toContain("published_upgrade_survivor_baselines:");
|
||||
expect(workflow).toContain("scripts/resolve-upgrade-survivor-baselines.mjs");
|
||||
expect(workflow).toContain("--history-count 6");
|
||||
expect(workflow).toContain("--include-version 2026.4.23");
|
||||
expect(workflow).toContain("--pre-date 2026-03-15T00:00:00Z");
|
||||
expect(workflow).toContain("npm-onboard-channel-agent gateway-network config-reload");
|
||||
expect(workflow).toContain("npm-onboard-channel-agent doctor-switch");
|
||||
expect(workflow).toContain("update-channel-switch upgrade-survivor");
|
||||
@@ -68,7 +73,11 @@ describe("package acceptance workflow", () => {
|
||||
expect(workflow).toContain(
|
||||
"published_upgrade_survivor_baseline: ${{ inputs.published_upgrade_survivor_baseline }}",
|
||||
);
|
||||
expect(workflow).toContain(
|
||||
"published_upgrade_survivor_baselines: ${{ needs.resolve_package.outputs.published_upgrade_survivor_baselines }}",
|
||||
);
|
||||
expect(workflow).toContain("Published upgrade survivor baseline:");
|
||||
expect(workflow).toContain("Published upgrade survivor baselines:");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -82,12 +91,16 @@ describe("package artifact reuse", () => {
|
||||
expect(workflow).toContain("package_artifact_name:");
|
||||
expect(workflow).toContain("package_artifact_run_id:");
|
||||
expect(workflow).toContain("published_upgrade_survivor_baseline:");
|
||||
expect(workflow).toContain("published_upgrade_survivor_baselines:");
|
||||
expect(workflow).toContain("docker_e2e_bare_image:");
|
||||
expect(workflow).toContain("docker_e2e_functional_image:");
|
||||
expect(workflow).toContain("OPENCLAW_DOCKER_E2E_SELECTED_SHA:");
|
||||
expect(workflow).toContain(
|
||||
"OPENCLAW_UPGRADE_SURVIVOR_BASELINE_SPEC: ${{ inputs.published_upgrade_survivor_baseline }}",
|
||||
);
|
||||
expect(workflow).toContain(
|
||||
"OPENCLAW_UPGRADE_SURVIVOR_BASELINE_SPECS: ${{ inputs.published_upgrade_survivor_baselines }}",
|
||||
);
|
||||
expect(workflow).toContain("Download current-run OpenClaw Docker E2E package");
|
||||
expect(workflow).toContain("Download previous-run OpenClaw Docker E2E package");
|
||||
expect(workflow).toContain("inputs.package_artifact_name != ''");
|
||||
@@ -113,9 +126,13 @@ describe("package artifact reuse", () => {
|
||||
expect(scheduler).toContain(
|
||||
"published_upgrade_survivor_baseline=${shellQuote(process.env.OPENCLAW_UPGRADE_SURVIVOR_BASELINE_SPEC)}",
|
||||
);
|
||||
expect(scheduler).toContain(
|
||||
"published_upgrade_survivor_baselines=${shellQuote(process.env.OPENCLAW_UPGRADE_SURVIVOR_BASELINE_SPECS)}",
|
||||
);
|
||||
expect(scheduler).toContain(
|
||||
'["OPENCLAW_UPGRADE_SURVIVOR_BASELINE_SPEC", baseEnv.OPENCLAW_UPGRADE_SURVIVOR_BASELINE_SPEC]',
|
||||
);
|
||||
expect(scheduler).toContain('["OPENCLAW_UPGRADE_SURVIVOR_BASELINE_SPECS",');
|
||||
expect(packageJson).toContain("OPENCLAW_UPGRADE_SURVIVOR_PUBLISHED_BASELINE=1");
|
||||
expect(publishedUpgradeSurvivor).toContain("validate_baseline_package_spec");
|
||||
expect(publishedUpgradeSurvivor).toContain("openclaw@(beta|latest|");
|
||||
|
||||
66
test/scripts/upgrade-survivor-baselines.test.ts
Normal file
66
test/scripts/upgrade-survivor-baselines.test.ts
Normal file
@@ -0,0 +1,66 @@
|
||||
import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import path from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { resolveBaselines } from "../../scripts/resolve-upgrade-survivor-baselines.mjs";
|
||||
|
||||
function withReleaseFixture<T>(releases: unknown[], fn: (file: string) => T): T {
|
||||
const dir = mkdtempSync(path.join(tmpdir(), "openclaw-upgrade-baselines-"));
|
||||
try {
|
||||
const file = path.join(dir, "releases.json");
|
||||
writeFileSync(file, `${JSON.stringify(releases)}\n`);
|
||||
return fn(file);
|
||||
} finally {
|
||||
rmSync(dir, { force: true, recursive: true });
|
||||
}
|
||||
}
|
||||
|
||||
describe("scripts/resolve-upgrade-survivor-baselines", () => {
|
||||
it("keeps the single fallback baseline when no expanded request is provided", () => {
|
||||
expect(resolveBaselines(new Map([["fallback", "2026.4.23"]]))).toEqual(["openclaw@2026.4.23"]);
|
||||
});
|
||||
|
||||
it("resolves release-history to last six stable releases plus explicit legacy anchors", () => {
|
||||
const releases = (
|
||||
[
|
||||
["v2026.4.29", "2026-04-30T00:00:00Z"],
|
||||
["v2026.4.27", "2026-04-28T00:00:00Z"],
|
||||
["v2026.4.26", "2026-04-27T00:00:00Z"],
|
||||
["v2026.4.25", "2026-04-26T00:00:00Z"],
|
||||
["v2026.4.24", "2026-04-25T00:00:00Z"],
|
||||
["v2026.4.22", "2026-04-23T00:00:00Z"],
|
||||
["v2026.4.23", "2026-04-22T00:00:00Z"],
|
||||
["v2026.3.13-1", "2026-03-14T18:04:00Z"],
|
||||
["v2026.3.12", "2026-03-12T00:00:00Z"],
|
||||
["v2026.4.30-beta.1", "2026-05-01T00:00:00Z", true],
|
||||
] as const
|
||||
).map(([tagName, publishedAt, isPrerelease = false]) => ({
|
||||
isPrerelease,
|
||||
publishedAt,
|
||||
tagName,
|
||||
}));
|
||||
|
||||
withReleaseFixture(releases, (file) => {
|
||||
expect(
|
||||
resolveBaselines(
|
||||
new Map([
|
||||
["requested", "release-history 2026.4.29"],
|
||||
["releases-json", file],
|
||||
["history-count", "6"],
|
||||
["include-version", "2026.4.23"],
|
||||
["pre-date", "2026-03-15T00:00:00Z"],
|
||||
]),
|
||||
),
|
||||
).toEqual([
|
||||
"openclaw@2026.4.29",
|
||||
"openclaw@2026.4.27",
|
||||
"openclaw@2026.4.26",
|
||||
"openclaw@2026.4.25",
|
||||
"openclaw@2026.4.24",
|
||||
"openclaw@2026.4.22",
|
||||
"openclaw@2026.4.23",
|
||||
"openclaw@2026.3.13-1",
|
||||
]);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user