mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-31 20:01:36 +00:00
feat(cli): support targeting running containerized openclaw instances (#52651)
Signed-off-by: sallyom <somalley@redhat.com>
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { theme } from "../../terminal/theme.js";
|
||||
import { resolveRuntimeStatusColor } from "./shared.js";
|
||||
import {
|
||||
filterContainerGenericHints,
|
||||
renderGatewayServiceStartHints,
|
||||
resolveRuntimeStatusColor,
|
||||
} from "./shared.js";
|
||||
|
||||
describe("resolveRuntimeStatusColor", () => {
|
||||
it("maps known runtime states to expected theme colors", () => {
|
||||
@@ -14,3 +18,55 @@ describe("resolveRuntimeStatusColor", () => {
|
||||
expect(resolveRuntimeStatusColor(undefined)).toBe(theme.muted);
|
||||
});
|
||||
});
|
||||
|
||||
describe("renderGatewayServiceStartHints", () => {
|
||||
it("prepends a single container restart hint when OPENCLAW_CONTAINER is set", () => {
|
||||
expect(
|
||||
renderGatewayServiceStartHints({
|
||||
OPENCLAW_CONTAINER: "openclaw-demo-container",
|
||||
} as NodeJS.ProcessEnv),
|
||||
).toEqual(
|
||||
expect.arrayContaining([
|
||||
"Restart the container or the service that manages it for openclaw-demo-container.",
|
||||
]),
|
||||
);
|
||||
});
|
||||
|
||||
it("prepends a single container restart hint when OPENCLAW_CONTAINER_HINT is set", () => {
|
||||
expect(
|
||||
renderGatewayServiceStartHints({
|
||||
OPENCLAW_CONTAINER_HINT: "openclaw-demo-container",
|
||||
} as NodeJS.ProcessEnv),
|
||||
).toEqual(
|
||||
expect.arrayContaining([
|
||||
"Restart the container or the service that manages it for openclaw-demo-container.",
|
||||
]),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("filterContainerGenericHints", () => {
|
||||
it("drops the generic container foreground hint when OPENCLAW_CONTAINER is set", () => {
|
||||
expect(
|
||||
filterContainerGenericHints(
|
||||
[
|
||||
"systemd user services are unavailable; install/enable systemd or run the gateway under your supervisor.",
|
||||
"If you're in a container, run the gateway in the foreground instead of `openclaw gateway`.",
|
||||
],
|
||||
{ OPENCLAW_CONTAINER: "openclaw-demo-container" } as NodeJS.ProcessEnv,
|
||||
),
|
||||
).toEqual([]);
|
||||
});
|
||||
|
||||
it("drops the generic container foreground hint when OPENCLAW_CONTAINER_HINT is set", () => {
|
||||
expect(
|
||||
filterContainerGenericHints(
|
||||
[
|
||||
"systemd user services are unavailable; install/enable systemd or run the gateway under your supervisor.",
|
||||
"If you're in a container, run the gateway in the foreground instead of `openclaw gateway`.",
|
||||
],
|
||||
{ OPENCLAW_CONTAINER_HINT: "openclaw-demo-container" } as NodeJS.ProcessEnv,
|
||||
),
|
||||
).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user