Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
0e598b8
test(inference): add shared vLLM install setup mechanics (#8351)
AzeelSajjad Aug 5, 2026
a0144d0
test(inference): use shared install setup in the vLLM storage suite (…
AzeelSajjad Aug 5, 2026
79f413e
test(inference): use shared install setup in the vLLM suite (#8351)
AzeelSajjad Aug 5, 2026
6500c94
test(inference): pin the ownership-queue freshness contract (#8351)
AzeelSajjad Aug 5, 2026
5ee4c08
test(inference): use shared install setup in the vLLM compute-capabil…
AzeelSajjad Aug 5, 2026
aad87aa
docs(inference): name all three consumers of the shared vLLM install …
AzeelSajjad Aug 5, 2026
1797233
test(inference): enforce shared setup freshness
apurvvkumaria Aug 5, 2026
582678a
test(inference): reset shared setup ownership mock
cjagwani Aug 5, 2026
6881dc8
merge(main): refresh PR #8392
cjagwani Aug 5, 2026
e713fb0
test(inference): isolate managed install paths
cjagwani Aug 5, 2026
095f138
merge(main): refresh PR #8392
cjagwani Aug 5, 2026
459990c
merge(main): refresh PR #8392
cjagwani Aug 5, 2026
2dd1cf1
ci(e2e): retry PR #8392 gate
cjagwani Aug 5, 2026
8cc377f
merge(main): refresh PR #8392
cjagwani Aug 5, 2026
1130650
test(e2e): retry transient ClawHub install outage
cjagwani Aug 5, 2026
0f7435a
test(e2e): remove unrelated ClawHub retry
cv Aug 6, 2026
f6d500c
merge(main): refresh PR #8392
cv Aug 6, 2026
22f5a5f
test(inference): clarify shared vLLM setup
cv Aug 6, 2026
f481a1a
merge: sync current main
cv Aug 6, 2026
046a29c
test(inference): correct shared setup descriptions
cv Aug 6, 2026
ec4ca65
merge: sync current main
cv Aug 6, 2026
a37323d
merge(main): refresh PR #8392
cv Aug 6, 2026
3e1dc39
merge(main): refresh PR #8392
cv Aug 6, 2026
77384ef
merge(main): refresh vLLM test helper refactor
apurvvkumaria Aug 6, 2026
75afc1e
test(inference): isolate vLLM API key setup
apurvvkumaria Aug 6, 2026
80c4fbb
merge(main): reconcile post-merge E2E policy
apurvvkumaria Aug 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ci/source-architecture-budget.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"src/lib/actions": 19,
"src/lib/actions/sandbox": 184,
"src/lib/state": 37,
"src/lib/inference": 62,
"src/lib/inference": 63,
"scripts": 46
}
}
123 changes: 29 additions & 94 deletions src/lib/inference/vllm-compute-capability.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

import { EventEmitter } from "node:events";
import fs from "node:fs";
import os from "node:os";
import path from "node:path";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";

const mocks = vi.hoisted(() => ({
Expand All @@ -21,6 +17,7 @@ const mocks = vi.hoisted(() => ({
probeDockerStorage: vi.fn(),
probeHostStorage: vi.fn(),
runCapture: vi.fn(),
tryInstallManagedClusterManagedVllm: vi.fn(async () => ({ kind: "not-selected" as const })),
}));

vi.mock("../runner", async (importOriginal) => ({
Expand Down Expand Up @@ -53,13 +50,28 @@ vi.mock("./vllm-storage", async (importOriginal) => {
};
});

vi.mock("./serving/vllm-managed-support", async (importOriginal) => {
const actual = await importOriginal<typeof import("./serving/vllm-managed-support")>();
return {
...actual,
tryInstallManagedClusterManagedVllm: mocks.tryInstallManagedClusterManagedVllm,
};
});

import {
computeCapabilityPreflight,
detectVllmProfile,
formatComputeCapability,
installVllm,
readGpuComputeCapabilities,
} from "./vllm";
import {
applyVllmInstallProbeDefaults,
createVllmInstallSpies,
mockDockerSpawnSuccess,
resetVllmInstallEnv,
type VllmInstallSpies,
} from "./vllm-install.test-support";
import { VLLM_MODELS } from "./vllm-models";

const READY_MODELS_RESPONSE = '{"data":[]}';
Expand All @@ -79,20 +91,6 @@ function mockHostCommands(options: { computeCap: string; curl?: string }): void
});
}

function mockDockerSpawnSuccess(): EventEmitter & {
stdout: EventEmitter;
stderr: EventEmitter;
} {
const proc = new EventEmitter() as EventEmitter & {
stdout: EventEmitter;
stderr: EventEmitter;
};
proc.stdout = new EventEmitter();
proc.stderr = new EventEmitter();
process.nextTick(() => proc.emit("exit", 0));
return proc;
}

function mockDockerDaemon(containerName: string, restartCount = "0"): void {
mocks.dockerPullWithProgressWatchdog.mockResolvedValue({
status: 0,
Expand All @@ -116,54 +114,22 @@ function mockDockerDaemon(containerName: string, restartCount = "0"): void {
}

describe("managed vLLM GPU compute capability preflight", () => {
let logSpy: ReturnType<typeof vi.spyOn>;
let errSpy: ReturnType<typeof vi.spyOn>;
let mkdirSpy: ReturnType<typeof vi.spyOn>;
let stdoutWrite: ReturnType<typeof vi.spyOn>;
let stderrWrite: ReturnType<typeof vi.spyOn>;
let errSpy: VllmInstallSpies["errSpy"];
let restoreSpies: VllmInstallSpies["restore"];
const originalEnv = { ...process.env };

beforeEach(() => {
vi.clearAllMocks();
mocks.dockerImageInspectFormat.mockReturnValue("");
mocks.findUnwritableModelCachePath.mockReturnValue(null);
mocks.measureDirectorySizeBytes.mockReturnValue(0n);
applyVllmInstallProbeDefaults(mocks);
mocks.getGpuIndicesByName.mockReturnValue([0]);
mocks.probeDockerStorage.mockReturnValue({
ok: true,
capacity: {
availableBytes: 1_000_000_000_000n,
filesystemId: "docker-fs",
path: "/docker",
source: "Docker",
},
});
mocks.probeHostStorage.mockReturnValue({
ok: true,
capacity: {
availableBytes: 1_000_000_000_000n,
filesystemId: "model-fs",
path: path.join(os.homedir(), ".cache", "huggingface"),
source: "Hugging Face cache",
},
});
logSpy = vi.spyOn(console, "log").mockImplementation(() => {});
errSpy = vi.spyOn(console, "error").mockImplementation(() => {});
mkdirSpy = vi.spyOn(fs, "mkdirSync").mockImplementation(() => undefined);
stdoutWrite = vi.spyOn(process.stdout, "write").mockImplementation(() => true);
stderrWrite = vi.spyOn(process.stderr, "write").mockImplementation(() => true);
delete process.env.NEMOCLAW_VLLM_MODEL;
delete process.env.NEMOCLAW_VLLM_EXTRA_ARGS_JSON;
mocks.tryInstallManagedClusterManagedVllm.mockResolvedValue({ kind: "not-selected" });
({ errSpy, restore: restoreSpies } = createVllmInstallSpies());
resetVllmInstallEnv();
process.env.HF_TOKEN = "hf_test";
delete process.env.HUGGING_FACE_HUB_TOKEN;
});

afterEach(() => {
logSpy.mockRestore();
errSpy.mockRestore();
mkdirSpy.mockRestore();
stdoutWrite.mockRestore();
stderrWrite.mockRestore();
restoreSpies();
process.env = { ...originalEnv };
});

Expand Down Expand Up @@ -250,53 +216,22 @@ describe("managed vLLM GPU compute capability preflight", () => {
});

describe("managed vLLM crash-loop watchdog", () => {
let logSpy: ReturnType<typeof vi.spyOn>;
let errSpy: ReturnType<typeof vi.spyOn>;
let mkdirSpy: ReturnType<typeof vi.spyOn>;
let stdoutWrite: ReturnType<typeof vi.spyOn>;
let stderrWrite: ReturnType<typeof vi.spyOn>;
let errSpy: VllmInstallSpies["errSpy"];
let restoreSpies: VllmInstallSpies["restore"];
const originalEnv = { ...process.env };

beforeEach(() => {
vi.clearAllMocks();
applyVllmInstallProbeDefaults(mocks);
mocks.dockerImageInspectFormat.mockReturnValue("sha256:cached-image");
mocks.findUnwritableModelCachePath.mockReturnValue(null);
mocks.measureDirectorySizeBytes.mockReturnValue(0n);
mocks.getGpuIndicesByName.mockReturnValue([0]);
mocks.probeHostStorage.mockReturnValue({
ok: true,
capacity: {
availableBytes: 1_000_000_000_000n,
filesystemId: "model-fs",
path: path.join(os.homedir(), ".cache", "huggingface"),
source: "Hugging Face cache",
},
});
mocks.probeDockerStorage.mockReturnValue({
ok: true,
capacity: {
availableBytes: 1_000_000_000_000n,
filesystemId: "docker-fs",
path: "/docker",
source: "Docker",
},
});
logSpy = vi.spyOn(console, "log").mockImplementation(() => {});
errSpy = vi.spyOn(console, "error").mockImplementation(() => {});
mkdirSpy = vi.spyOn(fs, "mkdirSync").mockImplementation(() => undefined);
stdoutWrite = vi.spyOn(process.stdout, "write").mockImplementation(() => true);
stderrWrite = vi.spyOn(process.stderr, "write").mockImplementation(() => true);
delete process.env.NEMOCLAW_VLLM_MODEL;
delete process.env.NEMOCLAW_VLLM_EXTRA_ARGS_JSON;
({ errSpy, restore: restoreSpies } = createVllmInstallSpies());
resetVllmInstallEnv();
process.env.HF_TOKEN = "hf_test";
});

afterEach(() => {
logSpy.mockRestore();
errSpy.mockRestore();
mkdirSpy.mockRestore();
stdoutWrite.mockRestore();
stderrWrite.mockRestore();
restoreSpies();
process.env = { ...originalEnv };
});

Expand Down
Loading
Loading