mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-13 10:00:44 +00:00
test: tighten secret audit status assertions
This commit is contained in:
@@ -76,21 +76,13 @@ describe("readServiceStatusSummary", () => {
|
||||
"Daemon",
|
||||
);
|
||||
|
||||
expect(isLoaded).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
env: expect.objectContaining({
|
||||
OPENCLAW_GATEWAY_PORT: "18789",
|
||||
}),
|
||||
}),
|
||||
);
|
||||
expect(readRuntime).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
OPENCLAW_GATEWAY_PORT: "18789",
|
||||
}),
|
||||
);
|
||||
const loadedArgs = isLoaded.mock.calls[0]?.[0];
|
||||
expect(loadedArgs?.env?.OPENCLAW_GATEWAY_PORT).toBe("18789");
|
||||
const runtimeEnv = readRuntime.mock.calls[0]?.[0];
|
||||
expect(runtimeEnv?.OPENCLAW_GATEWAY_PORT).toBe("18789");
|
||||
expect(summary.installed).toBe(true);
|
||||
expect(summary.loaded).toBe(true);
|
||||
expect(summary.runtime).toMatchObject({ status: "running" });
|
||||
expect(summary.runtime?.status).toBe("running");
|
||||
});
|
||||
|
||||
it("includes service layout diagnostics and flags source checkout entrypoints", async () => {
|
||||
@@ -122,17 +114,19 @@ describe("readServiceStatusSummary", () => {
|
||||
"Daemon",
|
||||
);
|
||||
|
||||
expect(summary.layout).toMatchObject({
|
||||
sourcePath: serviceFile,
|
||||
sourcePathReal: path.join(realRoot, "openclaw-gateway.service"),
|
||||
entrypoint,
|
||||
entrypointReal: path.join(realRoot, "dist", "index.js"),
|
||||
packageRoot: realRoot,
|
||||
packageRootReal: realRoot,
|
||||
packageVersion: "0.0.0-test",
|
||||
entrypointSourceCheckout: true,
|
||||
});
|
||||
expect(summary.layout?.execStart).toContain("gateway run");
|
||||
const layout = summary.layout;
|
||||
if (!layout) {
|
||||
throw new Error("Expected service layout diagnostics");
|
||||
}
|
||||
expect(layout.sourcePath).toBe(serviceFile);
|
||||
expect(layout.sourcePathReal).toBe(path.join(realRoot, "openclaw-gateway.service"));
|
||||
expect(layout.entrypoint).toBe(entrypoint);
|
||||
expect(layout.entrypointReal).toBe(path.join(realRoot, "dist", "index.js"));
|
||||
expect(layout.packageRoot).toBe(realRoot);
|
||||
expect(layout.packageRootReal).toBe(realRoot);
|
||||
expect(layout.packageVersion).toBe("0.0.0-test");
|
||||
expect(layout.entrypointSourceCheckout).toBe(true);
|
||||
expect(layout.execStart).toContain("gateway run");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -404,33 +404,31 @@ describe("secrets runtime externalized channel SecretRef audit", () => {
|
||||
expect(
|
||||
getPath(snapshot.config, ["channels", "zalo", "accounts", "disabled", "botToken"]),
|
||||
).toEqual(inactiveExecRef("ZALO_DISABLED_ACCOUNT_BOT_TOKEN"));
|
||||
expect(snapshot.warnings.map((warning) => warning.path)).toEqual(
|
||||
expect.arrayContaining([
|
||||
"channels.discord.token",
|
||||
"channels.discord.pluralkit.token",
|
||||
"channels.discord.voice.tts.providers.openai.apiKey",
|
||||
"channels.discord.accounts.disabled.token",
|
||||
"channels.discord.accounts.disabled.pluralkit.token",
|
||||
"channels.discord.accounts.disabled.voice.tts.providers.openai.apiKey",
|
||||
"channels.feishu.appSecret",
|
||||
"channels.feishu.encryptKey",
|
||||
"channels.feishu.verificationToken",
|
||||
"channels.feishu.accounts.disabled.appSecret",
|
||||
"channels.feishu.accounts.disabled.encryptKey",
|
||||
"channels.feishu.accounts.disabled.verificationToken",
|
||||
"channels.googlechat.serviceAccount",
|
||||
"channels.googlechat.accounts.disabled.serviceAccount",
|
||||
"channels.msteams.appPassword",
|
||||
"channels.nextcloud-talk.botSecret",
|
||||
"channels.nextcloud-talk.apiPassword",
|
||||
"channels.nextcloud-talk.accounts.disabled.botSecret",
|
||||
"channels.nextcloud-talk.accounts.disabled.apiPassword",
|
||||
"channels.zalo.botToken",
|
||||
"channels.zalo.webhookSecret",
|
||||
"channels.zalo.accounts.disabled.botToken",
|
||||
"channels.zalo.accounts.disabled.webhookSecret",
|
||||
]),
|
||||
);
|
||||
expect(snapshot.warnings.map((warning) => warning.path)).toStrictEqual([
|
||||
"channels.discord.token",
|
||||
"channels.discord.accounts.disabled.token",
|
||||
"channels.discord.pluralkit.token",
|
||||
"channels.discord.accounts.disabled.pluralkit.token",
|
||||
"channels.discord.voice.tts.providers.openai.apiKey",
|
||||
"channels.discord.accounts.disabled.voice.tts.providers.openai.apiKey",
|
||||
"channels.feishu.appSecret",
|
||||
"channels.feishu.accounts.disabled.appSecret",
|
||||
"channels.feishu.encryptKey",
|
||||
"channels.feishu.accounts.disabled.encryptKey",
|
||||
"channels.feishu.verificationToken",
|
||||
"channels.feishu.accounts.disabled.verificationToken",
|
||||
"channels.googlechat.serviceAccount",
|
||||
"channels.googlechat.accounts.disabled.serviceAccount",
|
||||
"channels.msteams.appPassword",
|
||||
"channels.nextcloud-talk.botSecret",
|
||||
"channels.nextcloud-talk.accounts.disabled.botSecret",
|
||||
"channels.nextcloud-talk.apiPassword",
|
||||
"channels.nextcloud-talk.accounts.disabled.apiPassword",
|
||||
"channels.zalo.botToken",
|
||||
"channels.zalo.accounts.disabled.botToken",
|
||||
"channels.zalo.webhookSecret",
|
||||
"channels.zalo.accounts.disabled.webhookSecret",
|
||||
]);
|
||||
expectMetadataBackedContractsWereUsed();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user