Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Test missing work queue branch handling
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
  • Loading branch information
Copilot and pelikhan authored Oct 9, 2026
commit 26f2e19cd2ed8a53dd44264783346a9ecf5c048d
25 changes: 24 additions & 1 deletion actions/setup/js/work_queue_compaction.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const os = require("node:os");
const path = require("node:path");
const { test } = require("node:test");
const { canonical } = require("./work_queue_codec.cjs");
const { planFor } = require("./work_queue_compaction_plan.cjs");
const { main: planCompaction, planFor } = require("./work_queue_compaction_plan.cjs");
const { isRetryablePublicationError, main: apply, PLAN_MAX_BYTES, readPlan } = require("./work_queue_compaction_apply.cjs");
const { fakeGitHub } = require("./work_queue_store_checks.cjs");

Expand Down Expand Up @@ -77,6 +77,29 @@ test("planning skips absent queues and binds the current head and tip", () => {
);
});

test("planning skips when the work-queue branch is missing", async () => {
const original = global.core;
const outputs = {};
global.core = {
setOutput(name, value) {
outputs[name] = value;
},
info() {},
};
const fake = fakeGitHub();
const directory = fs.mkdtempSync(path.join(os.tmpdir(), "work-queue-compaction-test-"));
const file = path.join(directory, "plan.json");
try {
const result = await planCompaction({ githubClient: fake.githubClient, owner: "owner", repo: "repo", planFile: file });
assert.equal(result.status, "skipped");
assert.equal(outputs.plan_created, "false");
assert.equal(fs.existsSync(file), false);
} finally {
global.core = original;
fs.rmSync(directory, { recursive: true, force: true });
}
});

test("apply rejects malformed plans and defers stale plans without writing", async () => {
const original = global.core;
global.core = { setOutput() {}, info() {}, warning() {} };
Expand Down
Loading