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
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { describe, it, expect, vi } from "vitest";
import { render, screen } from "@testing-library/react";

import { VllmConfig } from "../configSections";

function renderVllm(amiRequired: boolean) {
const state = {
selectedEngine: "vllm",
dtype: "auto",
quantization: "",
maxModelLen: "",
gpuUtil: "0.9",
enforceEager: false,
selectedAmiId: "",
selectedHfTokenName: "",
prefillReplicas: 1,
decodeReplicas: 1,
prefillGpuIndices: "",
decodeGpuIndices: "",
isDisaggOpen: false,
};
return render(
<VllmConfig
state={state as never}
dispatch={vi.fn()}
engineAmis={[]}
amisLoading={false}
amiRegion="us-east-1"
amiRequired={amiRequired}
hfTokenNames={[]}
/>
);
}

// The label carries the required asterisk, so it is the thing that must not
// appear where no AMI is needed.
const amiLabel = () => document.querySelector('label[for="engineAmi"]');

describe("the engine AMI field follows requiresAmi", () => {
it("is not shown for vLLM on a pool that needs no AMI, such as Kubernetes", () => {
renderVllm(false);
expect(amiLabel()).toBeNull();
expect(screen.queryByText(/engine ami/i)).toBeNull();
});

it("is shown, marked required, for vLLM on an AWS pool", () => {
renderVllm(true);
expect(amiLabel()).not.toBeNull();
expect(amiLabel()?.textContent).toContain("*");
});
});
6 changes: 4 additions & 2 deletions apps/dashboard/src/components/deployment/configSections.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -358,11 +358,13 @@ export function VllmConfig({
engineAmis,
amisLoading,
amiRegion,
amiRequired,
hfTokenNames,
}: SectionProps & {
engineAmis: EngineAmi[]
amisLoading: boolean
amiRegion: string
amiRequired: boolean
hfTokenNames: string[]
}) {
const {
Expand All @@ -375,8 +377,8 @@ export function VllmConfig({
<div className="space-y-4 p-4 bg-muted/50 rounded-lg border">
<div className="flex items-center gap-2 mb-2"><Cpu className="w-4 h-4 text-primary" /><h4 className="font-medium text-sm">{selectedEngine === "sglang" ? "SGLang" : "vLLM"} Configuration</h4></div>

{/* Engine AMI dropdown (required for vLLM only) */}
{selectedEngine === "vllm" && (
{/* Engine AMI dropdown: vLLM on an AWS pool only */}
{amiRequired && (
<EngineAmiSelect
selectedAmiId={selectedAmiId}
dispatch={dispatch}
Expand Down
1 change: 1 addition & 0 deletions apps/dashboard/src/pages/NewDeployment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1253,6 +1253,7 @@ function ManagedConfig({ state, dispatch, onLaunch, isPending, externalRegistry
engineAmis={engineAmis}
amisLoading={amisLoading}
amiRegion={amiRegion}
amiRequired={isAwsPool}
hfTokenNames={hfTokenNames}
/>
)}
Expand Down
Loading