fix: wire slack deps and stabilize sigterm test

This commit is contained in:
Peter Steinberger
2026-01-04 15:13:23 +01:00
parent 378e4c9b6b
commit ec09b06636
3 changed files with 12 additions and 2 deletions

View File

@@ -2,6 +2,7 @@ import { sendMessageDiscord } from "../discord/send.js";
import { sendMessageIMessage } from "../imessage/send.js"; import { sendMessageIMessage } from "../imessage/send.js";
import { logWebSelfId, sendMessageWhatsApp } from "../providers/web/index.js"; import { logWebSelfId, sendMessageWhatsApp } from "../providers/web/index.js";
import { sendMessageSignal } from "../signal/send.js"; import { sendMessageSignal } from "../signal/send.js";
import { sendMessageSlack } from "../slack/send.js";
import { sendMessageTelegram } from "../telegram/send.js"; import { sendMessageTelegram } from "../telegram/send.js";
export type CliDeps = { export type CliDeps = {

View File

@@ -1,5 +1,8 @@
import { spawn } from "node:child_process"; import { spawn } from "node:child_process";
import fs from "node:fs";
import net from "node:net"; import net from "node:net";
import os from "node:os";
import path from "node:path";
import { afterEach, describe, expect, it } from "vitest"; import { afterEach, describe, expect, it } from "vitest";
const waitForPortOpen = async ( const waitForPortOpen = async (
@@ -72,8 +75,11 @@ describe("gateway SIGTERM", () => {
child = null; child = null;
}); });
it("exits 0 on SIGTERM", { timeout: 60_000 }, async () => { it("exits 0 on SIGTERM", { timeout: 90_000 }, async () => {
const port = await getFreePort(); const port = await getFreePort();
const stateDir = fs.mkdtempSync(
path.join(os.tmpdir(), "clawdis-gateway-test-"),
);
const out: string[] = []; const out: string[] = [];
const err: string[] = []; const err: string[] = [];
@@ -94,6 +100,8 @@ describe("gateway SIGTERM", () => {
cwd: process.cwd(), cwd: process.cwd(),
env: { env: {
...process.env, ...process.env,
CLAWDIS_STATE_DIR: stateDir,
CLAWDIS_CONFIG_PATH: path.join(stateDir, "clawdis.json"),
CLAWDIS_SKIP_PROVIDERS: "1", CLAWDIS_SKIP_PROVIDERS: "1",
CLAWDIS_SKIP_BROWSER_CONTROL_SERVER: "1", CLAWDIS_SKIP_BROWSER_CONTROL_SERVER: "1",
CLAWDIS_SKIP_CANVAS_HOST: "1", CLAWDIS_SKIP_CANVAS_HOST: "1",
@@ -113,7 +121,7 @@ describe("gateway SIGTERM", () => {
child.stdout?.on("data", (d) => out.push(String(d))); child.stdout?.on("data", (d) => out.push(String(d)));
child.stderr?.on("data", (d) => err.push(String(d))); child.stderr?.on("data", (d) => err.push(String(d)));
await waitForPortOpen(proc, out, err, port, 45_000); await waitForPortOpen(proc, out, err, port, 75_000);
proc.kill("SIGTERM"); proc.kill("SIGTERM");

View File

@@ -22,6 +22,7 @@ import { getQueueSize } from "../process/command-queue.js";
import { webAuthExists } from "../providers/web/index.js"; import { webAuthExists } from "../providers/web/index.js";
import { defaultRuntime, type RuntimeEnv } from "../runtime.js"; import { defaultRuntime, type RuntimeEnv } from "../runtime.js";
import { sendMessageSignal } from "../signal/send.js"; import { sendMessageSignal } from "../signal/send.js";
import { sendMessageSlack } from "../slack/send.js";
import { sendMessageTelegram } from "../telegram/send.js"; import { sendMessageTelegram } from "../telegram/send.js";
import { normalizeE164 } from "../utils.js"; import { normalizeE164 } from "../utils.js";
import { getActiveWebListener } from "../web/active-listener.js"; import { getActiveWebListener } from "../web/active-listener.js";