Skip to content
Merged
Show file tree
Hide file tree
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
8 changes: 7 additions & 1 deletion tests/sim/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,13 @@ function* startPlan(trigger: string): MainPlan {
},
},
};
for (const id of opened.value?.launchable ?? []) yield { call: { name: "dispatch_step", args: { ticketId: id, launch: true } } };
for (const id of opened.value?.launchable ?? [])
yield {
call: {
name: "dispatch_step",
args: { ticketId: id, launch: true, ...(scenario.launchRole === undefined ? {} : { role: scenario.launchRole }) },
},
};
}

function* attentionPlan(trigger: string): MainPlan {
Expand Down
17 changes: 15 additions & 2 deletions tests/sim/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,8 @@ function normalizeDispatchCall(name: string | undefined, args: Record<string, un
}
if (name === "dispatch_step") {
const ticketId = typeof args.ticketId === "string" ? args.ticketId : undefined;
if (typeof args.launch === "object" && args.launch !== null) {
const role = (args.launch as { role?: unknown }).role;
if (args.launch === true) {
const role = args.role;
return {
op: "launch",
...(ticketId !== undefined ? { ticketId } : {}),
Expand Down Expand Up @@ -1408,6 +1408,19 @@ cases.push({
meerkat: { holdComment: null },
check: async (run) => [...(await tree.check(run)), ...(await meerkatChecks(run))],
});
const head = cases.find((item) => item.name === "head")!;
const ROLE_LAUNCH = "Main named a role in launch";
cases.push({
...head,
name: "launch-role",
scenario: (markers) => ({ ...head.scenario(markers), launchRole: "owner" }),
check: async (run) => {
const failures = await head.check(run);
return failures.includes(ROLE_LAUNCH)
? failures.filter((failure) => failure !== ROLE_LAUNCH)
: [...failures, `${ROLE_LAUNCH} went unreported`];
},
});
cases.push(...askCases({ agenda, waitUntil, start, kill, modelLog, seatSessions, simState, commonChecks }));

const selected = process.argv.slice(2);
Expand Down
1 change: 1 addition & 0 deletions tests/sim/scenario.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export const scenarioSchema = z.object({
workRoles: z.array(z.string()),
retryFailed: z.string().optional(),
resumeFirst: z.string().optional(),
launchRole: z.string().optional(),
log: z.string(),
});
export type Scenario = z.infer<typeof scenarioSchema>;
Loading