Skip to content
Merged
Changes from all commits
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
11 changes: 8 additions & 3 deletions tests/project-shared-helpers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@ async function readHelperClaim(
async function ownedIdentity(root: string, helper: ProjectSharedHelperConfig) {
const claim = await readHelperClaim(root, helper);
if (claim?.ownership !== "owned") {
throw new Error("expected an owned claim");
throw new Error(
`expected an owned claim; observed ${claim?.ownership ?? "missing"}`
);
}
return { pid: claim.pid, birth: claim.birth };
}
Expand Down Expand Up @@ -404,19 +406,22 @@ test(
async () => {
const root = await scratch();
const first = helperConfig({ port: freePort() });
// Bind the first helper before selecting the second port: released port-0
// probes can return the same port, letting the foreign listener satisfy first.

// Branch A already holds the first helper from an earlier successful up.
await startProjectSharedHelpers({
...context(root),
helpers: [first],
composeProject: BRANCH_A,
});
const owned = await ownedIdentity(root, first);

// Keep the first port bound while selecting the second: two closed bind
// probes can return the same port, making the foreign fixture look adoptable.
const second = helperConfig({
port: freePort(),
name: "second-bridge",
});
expect(second.port).not.toBe(first.port);
// The second port is held by a different helper kind (foreign).
const other = await startForeign({
root,
Expand Down
Loading