Skip to content

Commit 6e6d1aa

Browse files
committed
test(openai): add focused realtime live smoke
1 parent f056494 commit 6e6d1aa

3 files changed

Lines changed: 29 additions & 13 deletions

File tree

docs/providers/openai.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -825,6 +825,7 @@ compatibility fallback when the shared
825825
`OPENAI_API_KEY=... GEMINI_API_KEY=... node --import tsx scripts/dev/realtime-talk-live-smoke.ts`;
826826
the OpenAI legs verify both the backend WebSocket bridge and the browser
827827
WebRTC SDP exchange without logging secrets.
828+
Pass `--openai-only` to run those two legs without Google credentials.
828829
</Note>
829830

830831
</Accordion>

scripts/dev/realtime-talk-live-smoke.ts

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const GOOGLE_LIVE_WS_URL =
2424

2525
type RealtimeSmokeCliOptions = {
2626
help: boolean;
27+
openAIOnly: boolean;
2728
};
2829

2930
// Keep live stacks behind their owning smoke paths so help and safety helpers stay lightweight.
@@ -66,7 +67,8 @@ function usage(): string {
6667
"Usage: node --import tsx scripts/dev/realtime-talk-live-smoke.ts [options]",
6768
"",
6869
"Options:",
69-
" -h, --help Show this help",
70+
" --openai-only Run only the OpenAI backend and browser legs",
71+
" -h, --help Show this help",
7072
"",
7173
"Environment:",
7274
" OPENAI_API_KEY",
@@ -76,12 +78,15 @@ function usage(): string {
7678

7779
function parseRealtimeSmokeArgs(argv = process.argv.slice(2)): RealtimeSmokeCliOptions {
7880
for (const arg of argv) {
79-
if (arg === "--help" || arg === "-h") {
81+
if (arg === "--help" || arg === "-h" || arg === "--openai-only") {
8082
continue;
8183
}
8284
throw new CliArgumentError(`Unknown argument: ${arg}`);
8385
}
84-
return { help: argv.includes("--help") || argv.includes("-h") };
86+
return {
87+
help: argv.includes("--help") || argv.includes("-h"),
88+
openAIOnly: argv.includes("--openai-only"),
89+
};
8590
}
8691

8792
function getEnv(name: string): string | undefined {
@@ -799,16 +804,18 @@ async function main(argv = process.argv.slice(2)): Promise<void> {
799804
results.push(await smokeOpenAIBackendBridge(openAIKey));
800805
results.push(await smokeOpenAIWebRtc(browser, openAIKey));
801806
}
802-
if (!googleKey) {
803-
results.push({
804-
name: "google-live-browser-ws",
805-
ok: false,
806-
details: { error: "GEMINI_API_KEY or GOOGLE_API_KEY missing" },
807-
});
808-
} else {
809-
results.push(await smokeGoogleLiveBrowserWs(browser, googleKey));
807+
if (!cli.openAIOnly) {
808+
if (!googleKey) {
809+
results.push({
810+
name: "google-live-browser-ws",
811+
ok: false,
812+
details: { error: "GEMINI_API_KEY or GOOGLE_API_KEY missing" },
813+
});
814+
} else {
815+
results.push(await smokeGoogleLiveBrowserWs(browser, googleKey));
816+
}
817+
results.push(await smokeGatewayRelayBrowser(browser));
810818
}
811-
results.push(await smokeGatewayRelayBrowser(browser));
812819
} finally {
813820
await browser.close();
814821
}

test/scripts/dev-tooling-safety.test.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,10 +594,18 @@ describe("script-specific dev tooling hardening", () => {
594594
});
595595

596596
it("formats OpenAI realtime smoke help without launching live checks", () => {
597-
expect(realtimeSmokeTesting.parseRealtimeSmokeArgs(["--help"])).toEqual({ help: true });
597+
expect(realtimeSmokeTesting.parseRealtimeSmokeArgs(["--help"])).toEqual({
598+
help: true,
599+
openAIOnly: false,
600+
});
601+
expect(realtimeSmokeTesting.parseRealtimeSmokeArgs(["--openai-only"])).toEqual({
602+
help: false,
603+
openAIOnly: true,
604+
});
598605
expect(realtimeSmokeTesting.usage()).toContain(
599606
"Usage: node --import tsx scripts/dev/realtime-talk-live-smoke.ts",
600607
);
608+
expect(realtimeSmokeTesting.usage()).toContain("--openai-only");
601609
});
602610

603611
it("rejects unknown OpenAI realtime smoke args before runtime setup", () => {

0 commit comments

Comments
 (0)