mirror of
https://github.com/moltbot/moltbot.git
synced 2026-04-25 23:47:20 +00:00
test: harden release gate flakes
This commit is contained in:
@@ -67,7 +67,7 @@ function createMockQaRuntime(): PluginRuntime {
|
||||
}
|
||||
|
||||
describe("qa-channel plugin", () => {
|
||||
it("roundtrips inbound DM traffic through the qa bus", async () => {
|
||||
it("roundtrips inbound DM traffic through the qa bus", { timeout: 20_000 }, async () => {
|
||||
const state = createQaBusState();
|
||||
const bus = await startQaBusServer({ state });
|
||||
setQaChannelRuntime(createMockQaRuntime());
|
||||
@@ -106,7 +106,7 @@ describe("qa-channel plugin", () => {
|
||||
kind: "message-text",
|
||||
textIncludes: "qa-echo: hello",
|
||||
direction: "outbound",
|
||||
timeoutMs: 5_000,
|
||||
timeoutMs: 15_000,
|
||||
});
|
||||
expect("text" in outbound && outbound.text).toContain("qa-echo: hello");
|
||||
} finally {
|
||||
|
||||
@@ -63,21 +63,33 @@ describe("resolveNonInteractiveApiKey", () => {
|
||||
it("rejects flag input in secret-ref mode without broad env discovery", async () => {
|
||||
const runtime = createRuntime();
|
||||
resolveEnvApiKey.mockReturnValue(null);
|
||||
const previousXaiApiKey = process.env.XAI_API_KEY;
|
||||
delete process.env.XAI_API_KEY;
|
||||
|
||||
const result = await resolveNonInteractiveApiKey({
|
||||
provider: "xai",
|
||||
cfg: {},
|
||||
flagValue: "xai-flag-key",
|
||||
flagName: "--xai-api-key",
|
||||
envVar: "XAI_API_KEY",
|
||||
runtime: runtime as never,
|
||||
secretInputMode: "ref",
|
||||
});
|
||||
try {
|
||||
const result = await resolveNonInteractiveApiKey({
|
||||
provider: "xai",
|
||||
cfg: {},
|
||||
flagValue: "xai-flag-key",
|
||||
flagName: "--xai-api-key",
|
||||
envVar: "XAI_API_KEY",
|
||||
runtime: runtime as never,
|
||||
secretInputMode: "ref",
|
||||
});
|
||||
|
||||
expect(result).toBeNull();
|
||||
expect(resolveEnvApiKey).not.toHaveBeenCalled();
|
||||
expect(runtime.exit).toHaveBeenCalledWith(1);
|
||||
expect(runtime.error).toHaveBeenCalledWith(expect.stringContaining("--secret-input-mode ref"));
|
||||
expect(result).toBeNull();
|
||||
expect(resolveEnvApiKey).not.toHaveBeenCalled();
|
||||
expect(runtime.exit).toHaveBeenCalledWith(1);
|
||||
expect(runtime.error).toHaveBeenCalledWith(
|
||||
expect.stringContaining("--secret-input-mode ref"),
|
||||
);
|
||||
} finally {
|
||||
if (previousXaiApiKey === undefined) {
|
||||
delete process.env.XAI_API_KEY;
|
||||
} else {
|
||||
process.env.XAI_API_KEY = previousXaiApiKey;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
it("falls back to a matching API-key profile after flag and env are absent", async () => {
|
||||
|
||||
Reference in New Issue
Block a user