Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
33 changes: 4 additions & 29 deletions src/lib/inference/serving/managed-cluster-discovery.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ import {
parseManagedClusterHostObservation,
probeManagedClusterManagedServingCapability,
} from "./managed-cluster-discovery.js";
import { FIXTURE_MANAGED_CLUSTER_PRESET_ID } from "./managed-cluster-fixture.test-support.js";
import {
FIXTURE_MANAGED_CLUSTER_PRESET_ID,
STOPPED_FOREIGN_CONTAINER_FIXTURES,
} from "./managed-cluster-fixture.test-support.js";
import { MANAGED_CLUSTER_MANAGED_LABEL } from "./managed-cluster-materialize.js";
import {
type ManagedVllmSshBinding,
Expand All @@ -44,34 +47,6 @@ const REQUIRED_CAPABILITIES = [
"host.gpu.cdi_healthy",
] as const;

type StoppedForeignContainerFixture = {
readonly signal: string;
readonly name: string;
readonly image: string;
readonly labels: Readonly<Record<string, string>>;
};

const STOPPED_FOREIGN_CONTAINER_FIXTURES: readonly StoppedForeignContainerFixture[] = [
{
signal: "name",
name: "foreign-vllm-server",
image: "example.invalid/inference:latest",
labels: {},
},
{
signal: "image",
name: "foreign-inference",
image: "vllm/vllm-openai:latest",
labels: {},
},
{
signal: "managed label",
name: "foreign-inference",
image: "example.invalid/inference:latest",
labels: { [MANAGED_CLUSTER_MANAGED_LABEL]: "foreign" },
},
];

function expectDetectedCluster(
detected: ReturnType<typeof probeManagedClusterManagedServingCapability>,
): ManagedClusterDetectedManagedServingCapability {
Expand Down
34 changes: 4 additions & 30 deletions src/lib/inference/serving/managed-cluster-executor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ import {
inspectManagedClusterVllmNodesSync,
type ManagedClusterVllmExecutorRuntimeDeps,
} from "./managed-cluster-executor.js";
import { fixtureManagedClusterPlan } from "./managed-cluster-fixture.test-support.js";
import {
fixtureManagedClusterPlan,
STOPPED_FOREIGN_CONTAINER_FIXTURES,
} from "./managed-cluster-fixture.test-support.js";
import {
MANAGED_CLUSTER_API_KEY_FINGERPRINT_LABEL,
MANAGED_CLUSTER_MANAGED_LABEL,
MANAGED_CLUSTER_TRANSACTION_LABEL,
type ManagedClusterVllmPlan,
type ManagedClusterVllmRole,
Expand All @@ -37,34 +39,6 @@ type DockerCaptureOptions = NonNullable<
Parameters<ManagedClusterVllmExecutorRuntimeDeps["dockerCapture"]>[1]
>;

type StoppedForeignContainerFixture = {
readonly signal: string;
readonly name: string;
readonly image: string;
readonly labels: Readonly<Record<string, string>>;
};

const STOPPED_FOREIGN_CONTAINER_FIXTURES: readonly StoppedForeignContainerFixture[] = [
{
signal: "name",
name: "foreign-vllm-server",
image: "example.invalid/inference:latest",
labels: {},
},
{
signal: "image",
name: "foreign-inference",
image: "vllm/vllm-openai:latest",
labels: {},
},
{
signal: "managed label",
name: "foreign-inference",
image: "example.invalid/inference:latest",
labels: { [MANAGED_CLUSTER_MANAGED_LABEL]: "foreign" },
},
];

function bindPlan(fixture: ManagedVllmSshBindingFixture): ManagedClusterVllmPlan {
const plan = fixtureManagedClusterPlan();
return {
Expand Down
33 changes: 31 additions & 2 deletions src/lib/inference/serving/managed-cluster-fixture.test-support.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import {
isManagedClusterInferenceServingRecipe,
MANAGED_CLUSTER_VLLM_MATERIALIZER_REF,
} from "./adapter-registry.js";
import { loadManagedInferenceCatalog } from "./catalog-loader.js";
import { managedInferenceDigest } from "./catalog-integrity.js";
import type { ResolvedManagedInferenceSelection } from "./types.js";
import { loadManagedInferenceCatalog } from "./catalog-loader.js";
import {
MANAGED_CLUSTER_MANAGED_LABEL,
type ManagedClusterVllmPlan,
materializeManagedClusterVllmPlan,
} from "./managed-cluster-materialize.js";
Expand All @@ -19,6 +19,35 @@ import {
managedClusterTopologyOutputDigest,
managedClusterTopologySubjectDigest,
} from "./managed-cluster-topology.js";
import type { ResolvedManagedInferenceSelection } from "./types.js";

export type StoppedForeignContainerFixture = {
readonly signal: string;
readonly name: string;
readonly image: string;
readonly labels: Readonly<Record<string, string>>;
};

export const STOPPED_FOREIGN_CONTAINER_FIXTURES: readonly StoppedForeignContainerFixture[] = [
{
signal: "name",
name: "foreign-vllm-server",
image: "example.invalid/inference:latest",
labels: {},
},
{
signal: "image",
name: "foreign-inference",
image: "vllm/vllm-openai:latest",
labels: {},
},
{
signal: "managed label",
name: "foreign-inference",
image: "example.invalid/inference:latest",
labels: { [MANAGED_CLUSTER_MANAGED_LABEL]: "foreign" },
},
];

function fixtureCatalogDefinitions() {
const catalog = loadManagedInferenceCatalog();
Expand Down
34 changes: 4 additions & 30 deletions src/lib/inference/serving/managed-cluster-lifecycle.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@

import { beforeEach, describe, expect, it, vi } from "vitest";

import { fixtureManagedClusterPlan } from "./managed-cluster-fixture.test-support.js";
import {
fixtureManagedClusterPlan,
STOPPED_FOREIGN_CONTAINER_FIXTURES,
} from "./managed-cluster-fixture.test-support.js";
import {
classifyManagedClusterExistingState,
cleanupManagedClusterManagedVllm,
Expand All @@ -16,7 +19,6 @@ import {
} from "./managed-cluster-lifecycle.js";
import {
MANAGED_CLUSTER_API_KEY_FINGERPRINT_LABEL,
MANAGED_CLUSTER_MANAGED_LABEL,
MANAGED_CLUSTER_TRANSACTION_LABEL,
type ManagedClusterVllmPlan,
type ManagedClusterVllmRole,
Expand All @@ -28,34 +30,6 @@ const TRANSACTION_ID = "b".repeat(32);
const HEAD_ID = "1".repeat(64);
const WORKER_ID = "2".repeat(64);

type StoppedForeignContainerFixture = {
readonly signal: string;
readonly name: string;
readonly image: string;
readonly labels: Readonly<Record<string, string>>;
};

const STOPPED_FOREIGN_CONTAINER_FIXTURES: readonly StoppedForeignContainerFixture[] = [
{
signal: "name",
name: "foreign-vllm-server",
image: "example.invalid/inference:latest",
labels: {},
},
{
signal: "image",
name: "foreign-inference",
image: "vllm/vllm-openai:latest",
labels: {},
},
{
signal: "managed label",
name: "foreign-inference",
image: "example.invalid/inference:latest",
labels: { [MANAGED_CLUSTER_MANAGED_LABEL]: "foreign" },
},
];

type Harness = ReturnType<typeof createHarness>;

function managedContainer(
Expand Down
Loading