mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-04 11:03:33 +00:00
fix(qa): reject loose ClickClack wait timeouts
This commit is contained in:
@@ -348,7 +348,11 @@ async function postClickClackInbound() {
|
||||
|
||||
async function waitClickClackSocket() {
|
||||
const baseUrl = process.argv[3];
|
||||
const timeoutSeconds = Number(process.argv[4] ?? 30);
|
||||
const timeoutSeconds = readPositiveInt(
|
||||
process.argv[4],
|
||||
30,
|
||||
"ClickClack websocket timeout seconds",
|
||||
);
|
||||
const deadline = Date.now() + timeoutSeconds * 1000;
|
||||
while (Date.now() < deadline) {
|
||||
const remainingMs = Math.max(1, deadline - Date.now());
|
||||
@@ -387,7 +391,7 @@ function assertClickClackState() {
|
||||
async function waitClickClackReply() {
|
||||
const statePath = process.argv[3];
|
||||
const marker = process.argv[4];
|
||||
const timeoutSeconds = Number(process.argv[5] ?? 30);
|
||||
const timeoutSeconds = readPositiveInt(process.argv[5], 30, "ClickClack reply timeout seconds");
|
||||
const deadline = Date.now() + timeoutSeconds * 1000;
|
||||
while (Date.now() < deadline) {
|
||||
if (fs.existsSync(statePath)) {
|
||||
|
||||
@@ -316,7 +316,7 @@ describe("release user journey assertions", () => {
|
||||
withEnv({ HOME: home, OPENCLAW_RELEASE_USER_JOURNEY_HTTP_TIMEOUT_MS: "100" }, () =>
|
||||
runReleaseUserJourneyAssertion("wait-clickclack-socket", [
|
||||
`http://127.0.0.1:${server.port}`,
|
||||
"0.2",
|
||||
"1",
|
||||
]),
|
||||
),
|
||||
).rejects.toThrow("Timed out waiting for ClickClack websocket connection");
|
||||
@@ -339,7 +339,7 @@ describe("release user journey assertions", () => {
|
||||
withEnv({ HOME: home, OPENCLAW_RELEASE_USER_JOURNEY_HTTP_TIMEOUT_MS: "100ms" }, () =>
|
||||
runReleaseUserJourneyAssertion("wait-clickclack-socket", [
|
||||
`http://127.0.0.1:${server.port}`,
|
||||
"0.2",
|
||||
"1",
|
||||
]),
|
||||
),
|
||||
).rejects.toThrow(
|
||||
@@ -351,6 +351,33 @@ describe("release user journey assertions", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("rejects loose ClickClack wait timeout args instead of parsing prefixes", async () => {
|
||||
const root = mkdtempSync(path.join(tmpdir(), "openclaw-release-user-assertions-"));
|
||||
const home = path.join(root, "home");
|
||||
const statePath = path.join(root, "state.json");
|
||||
|
||||
try {
|
||||
await expect(
|
||||
withEnv({ HOME: home }, () =>
|
||||
runReleaseUserJourneyAssertion("wait-clickclack-socket", ["http://127.0.0.1:9", "1e3"]),
|
||||
),
|
||||
).rejects.toThrow(
|
||||
'ClickClack websocket timeout seconds must be a positive integer. Got: "1e3"',
|
||||
);
|
||||
await expect(
|
||||
withEnv({ HOME: home }, () =>
|
||||
runReleaseUserJourneyAssertion("wait-clickclack-reply", [
|
||||
statePath,
|
||||
"OPENCLAW_E2E_OK",
|
||||
"30s",
|
||||
]),
|
||||
),
|
||||
).rejects.toThrow('ClickClack reply timeout seconds must be a positive integer. Got: "30s"');
|
||||
} finally {
|
||||
rmSync(root, { force: true, recursive: true });
|
||||
}
|
||||
});
|
||||
|
||||
it("bounds ClickClack fixture error response bodies", async () => {
|
||||
const root = mkdtempSync(path.join(tmpdir(), "openclaw-release-user-assertions-"));
|
||||
const home = path.join(root, "home");
|
||||
|
||||
Reference in New Issue
Block a user