mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 18:10:45 +00:00
test(e2e): repair OpenShell prerelease smoke
This commit is contained in:
@@ -52,7 +52,7 @@ async function runCommand(params: {
|
|||||||
args: string[];
|
args: string[];
|
||||||
cwd?: string;
|
cwd?: string;
|
||||||
env?: NodeJS.ProcessEnv;
|
env?: NodeJS.ProcessEnv;
|
||||||
stdin?: string | Buffer;
|
stdin?: string | Uint8Array;
|
||||||
allowFailure?: boolean;
|
allowFailure?: boolean;
|
||||||
timeoutMs?: number;
|
timeoutMs?: number;
|
||||||
}): Promise<ExecResult> {
|
}): Promise<ExecResult> {
|
||||||
@@ -117,7 +117,21 @@ async function commandAvailable(command: string): Promise<boolean> {
|
|||||||
allowFailure: true,
|
allowFailure: true,
|
||||||
timeoutMs: 20_000,
|
timeoutMs: 20_000,
|
||||||
});
|
});
|
||||||
return result.code === 0 || result.stdout.length > 0 || result.stderr.length > 0;
|
return result.code === 0;
|
||||||
|
} catch {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function openshellGatewayAvailable(command: string): Promise<boolean> {
|
||||||
|
try {
|
||||||
|
const result = await runCommand({
|
||||||
|
command,
|
||||||
|
args: ["gateway", "start", "--help"],
|
||||||
|
allowFailure: true,
|
||||||
|
timeoutMs: 20_000,
|
||||||
|
});
|
||||||
|
return result.code === 0 && `${result.stdout}\n${result.stderr}`.includes("--name");
|
||||||
} catch {
|
} catch {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -338,6 +352,9 @@ describe("openshell sandbox backend e2e", () => {
|
|||||||
if (!(await commandAvailable(OPENCLAW_OPENSHELL_COMMAND))) {
|
if (!(await commandAvailable(OPENCLAW_OPENSHELL_COMMAND))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!(await openshellGatewayAvailable(OPENCLAW_OPENSHELL_COMMAND))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const rootDir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-openshell-e2e-"));
|
const rootDir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-openshell-e2e-"));
|
||||||
const env = openshellEnv(rootDir);
|
const env = openshellEnv(rootDir);
|
||||||
|
|||||||
@@ -1279,7 +1279,7 @@
|
|||||||
"test:docker:plugins": "bash scripts/e2e/plugins-docker.sh",
|
"test:docker:plugins": "bash scripts/e2e/plugins-docker.sh",
|
||||||
"test:docker:qr": "bash scripts/e2e/qr-import-docker.sh",
|
"test:docker:qr": "bash scripts/e2e/qr-import-docker.sh",
|
||||||
"test:e2e": "node scripts/run-vitest.mjs run --config test/vitest/vitest.e2e.config.ts",
|
"test:e2e": "node scripts/run-vitest.mjs run --config test/vitest/vitest.e2e.config.ts",
|
||||||
"test:e2e:openshell": "OPENCLAW_E2E_OPENSHELL=1 node scripts/run-vitest.mjs run --config test/vitest/vitest.e2e.config.ts test/openshell-sandbox.e2e.test.ts",
|
"test:e2e:openshell": "OPENCLAW_E2E_OPENSHELL=1 node scripts/run-vitest.mjs run --config test/vitest/vitest.e2e.config.ts extensions/openshell/src/backend.e2e.test.ts",
|
||||||
"test:extension": "node scripts/test-extension.mjs",
|
"test:extension": "node scripts/test-extension.mjs",
|
||||||
"test:extensions": "node scripts/run-vitest.mjs run --config test/vitest/vitest.extensions.config.ts",
|
"test:extensions": "node scripts/run-vitest.mjs run --config test/vitest/vitest.extensions.config.ts",
|
||||||
"test:extensions:batch": "node scripts/test-extension-batch.mjs",
|
"test:extensions:batch": "node scripts/test-extension-batch.mjs",
|
||||||
|
|||||||
Reference in New Issue
Block a user