mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 22:58:26 +00:00
test(doctor): tighten legacy migration e2e timeout budgets
This commit is contained in:
@@ -15,8 +15,13 @@ import {
|
|||||||
writeConfigFile,
|
writeConfigFile,
|
||||||
} from "./doctor.e2e-harness.js";
|
} from "./doctor.e2e-harness.js";
|
||||||
|
|
||||||
|
const DOCTOR_MIGRATION_TIMEOUT_MS = 20_000;
|
||||||
|
|
||||||
describe("doctor command", () => {
|
describe("doctor command", () => {
|
||||||
it("migrates routing.allowFrom to channels.whatsapp.allowFrom", { timeout: 60_000 }, async () => {
|
it(
|
||||||
|
"migrates routing.allowFrom to channels.whatsapp.allowFrom",
|
||||||
|
{ timeout: DOCTOR_MIGRATION_TIMEOUT_MS },
|
||||||
|
async () => {
|
||||||
mockDoctorConfigSnapshot({
|
mockDoctorConfigSnapshot({
|
||||||
parsed: { routing: { allowFrom: ["+15555550123"] } },
|
parsed: { routing: { allowFrom: ["+15555550123"] } },
|
||||||
valid: false,
|
valid: false,
|
||||||
@@ -40,7 +45,8 @@ describe("doctor command", () => {
|
|||||||
allowFrom: ["+15555550123"],
|
allowFrom: ["+15555550123"],
|
||||||
});
|
});
|
||||||
expect(written.routing).toBeUndefined();
|
expect(written.routing).toBeUndefined();
|
||||||
});
|
},
|
||||||
|
);
|
||||||
|
|
||||||
it("does not add a new gateway auth token while fixing legacy issues on invalid config", async () => {
|
it("does not add a new gateway auth token while fixing legacy issues on invalid config", async () => {
|
||||||
mockDoctorConfigSnapshot({
|
mockDoctorConfigSnapshot({
|
||||||
@@ -80,7 +86,10 @@ describe("doctor command", () => {
|
|||||||
expect(auth).toBeUndefined();
|
expect(auth).toBeUndefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("skips legacy gateway services migration", { timeout: 60_000 }, async () => {
|
it(
|
||||||
|
"skips legacy gateway services migration",
|
||||||
|
{ timeout: DOCTOR_MIGRATION_TIMEOUT_MS },
|
||||||
|
async () => {
|
||||||
mockDoctorConfigSnapshot();
|
mockDoctorConfigSnapshot();
|
||||||
|
|
||||||
findLegacyGatewayServices.mockResolvedValueOnce([
|
findLegacyGatewayServices.mockResolvedValueOnce([
|
||||||
@@ -98,7 +107,8 @@ describe("doctor command", () => {
|
|||||||
|
|
||||||
expect(uninstallLegacyGatewayServices).not.toHaveBeenCalled();
|
expect(uninstallLegacyGatewayServices).not.toHaveBeenCalled();
|
||||||
expect(serviceInstall).not.toHaveBeenCalled();
|
expect(serviceInstall).not.toHaveBeenCalled();
|
||||||
});
|
},
|
||||||
|
);
|
||||||
|
|
||||||
it("offers to update first for git checkouts", async () => {
|
it("offers to update first for git checkouts", async () => {
|
||||||
delete process.env.OPENCLAW_UPDATE_IN_PROGRESS;
|
delete process.env.OPENCLAW_UPDATE_IN_PROGRESS;
|
||||||
|
|||||||
@@ -1,8 +1,13 @@
|
|||||||
import { describe, expect, it, vi } from "vitest";
|
import { describe, expect, it, vi } from "vitest";
|
||||||
import { readConfigFileSnapshot, writeConfigFile } from "./doctor.e2e-harness.js";
|
import { readConfigFileSnapshot, writeConfigFile } from "./doctor.e2e-harness.js";
|
||||||
|
|
||||||
|
const DOCTOR_MIGRATION_TIMEOUT_MS = 20_000;
|
||||||
|
|
||||||
describe("doctor command", () => {
|
describe("doctor command", () => {
|
||||||
it("migrates Slack/Discord dm.policy keys to dmPolicy aliases", { timeout: 60_000 }, async () => {
|
it(
|
||||||
|
"migrates Slack/Discord dm.policy keys to dmPolicy aliases",
|
||||||
|
{ timeout: DOCTOR_MIGRATION_TIMEOUT_MS },
|
||||||
|
async () => {
|
||||||
readConfigFileSnapshot.mockResolvedValue({
|
readConfigFileSnapshot.mockResolvedValue({
|
||||||
path: "/tmp/openclaw.json",
|
path: "/tmp/openclaw.json",
|
||||||
exists: true,
|
exists: true,
|
||||||
@@ -44,5 +49,6 @@ describe("doctor command", () => {
|
|||||||
expect(discord.dmPolicy).toBe("allowlist");
|
expect(discord.dmPolicy).toBe("allowlist");
|
||||||
expect(discord.allowFrom).toEqual(["123"]);
|
expect(discord.allowFrom).toEqual(["123"]);
|
||||||
expect(discord.dm).toEqual({ enabled: true });
|
expect(discord.dm).toEqual({ enabled: true });
|
||||||
});
|
},
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user