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
13 changes: 8 additions & 5 deletions e2eTest/project/templates.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,13 @@ describe(
const runtimePorts = new Map<string, number>();
let dev: ReturnType<CliRunner["start"]> | undefined;
let pendingOutput = "";
let devOutput = "";

/** Given dev-process output, records the ports announced by running runtimes. */
const captureDevOutput = (chunk: Buffer) => {
pendingOutput += chunk.toString();
const text = chunk.toString();
devOutput += text;
pendingOutput += text;
const lines = pendingOutput.split(/\r?\n/);
pendingOutput = lines.pop() ?? "";

Expand Down Expand Up @@ -221,21 +224,21 @@ describe(
async (runtime) => {
const sessionId = getSessionId(`${runtime.name}`);

// the server may take a bit to get ready, so we retry on a timeout.
// The server may take a bit to get ready, so we retry on a timeout.
const response = await retry(async () => {
if (!dev) {
throw new Error(`agentcore dev did not start. \nstdout/stdout = ${pendingOutput}`);
throw new Error(`agentcore dev did not start. \nstdout/stderr = ${devOutput}`);
}
if (dev.exitCode !== null) {
throw new Error(
`agentcore dev exited with code ${dev.exitCode ?? "unknown"}. \nstdout/stdout = ${pendingOutput}`,
`agentcore dev exited with code ${dev.exitCode ?? "unknown"}. \nstdout/stderr = ${devOutput}`,
);
}

const port = runtimePorts.get(runtime.name);
if (!port) {
throw new Error(
`Runtime '${runtime.name}' is not ready. \nstdout/stdout = ${pendingOutput}`,
`Runtime '${runtime.name}' is not ready. \nstdout/stderr = ${devOutput}`,
);
}

Expand Down
Loading