Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

Add explicit timeout for flaky tests

yuneng-jiangb93fe4b93e5b
diff --git a/ui/litellm-dashboard/src/components/team/team_info.test.tsx b/ui/litellm-dashboard/src/components/team/team_info.test.tsx
index 17041659cec..8ea1a1571a5 100644
--- a/ui/litellm-dashboard/src/components/team/team_info.test.tsx
+++ b/ui/litellm-dashboard/src/components/team/team_info.test.tsx
@@ -58,7 +58,7 @@ describe("TeamInfoView", () => {
team_memberships: [],
});
- vi.mocked(networking.getGuardrailsList).mockResolvedValue([]);
+ vi.mocked(networking.getGuardrailsList).mockResolvedValue({ guardrails: [] });
vi.mocked(networking.fetchMCPAccessGroups).mockResolvedValue([]);
render(
@@ -74,9 +74,13 @@ describe("TeamInfoView", () => {
premiumUser={false}
/>,
);
- await waitFor(() => {
- expect(screen.queryByText("User ID")).not.toBeNull();
- });
+ await waitFor(
+ () => {
+ expect(screen.queryByText("User ID")).not.toBeNull();
+ },
+ // This is a workaround to fix the flaky test issue. TODO: Remove this once we have a better solution.
+ { timeout: 10000 },
+ );
});
it("should not show all-proxy-models option when user has no access to it", async () => {
@@ -116,7 +120,7 @@ describe("TeamInfoView", () => {
team_memberships: [],
});
- vi.mocked(networking.getGuardrailsList).mockResolvedValue([]);
+ vi.mocked(networking.getGuardrailsList).mockResolvedValue({ guardrails: [] });
vi.mocked(networking.fetchMCPAccessGroups).mockResolvedValue([]);
render(
@@ -133,27 +137,39 @@ describe("TeamInfoView", () => {
/>,
);
- await waitFor(() => {
- expect(screen.getAllByText("Test Team")).not.toBeNull();
- });
+ await waitFor(
+ () => {
+ expect(screen.getAllByText("Test Team")).not.toBeNull();
+ },
+ // This is a workaround to fix the flaky test issue. TODO: Remove this once we have a better solution.
+ { timeout: 10000 },
+ );
const settingsTab = screen.getByRole("tab", { name: "Settings" });
act(() => {
fireEvent.click(settingsTab);
});
- await waitFor(() => {
- expect(screen.getByText("Team Settings")).toBeInTheDocument();
- });
+ await waitFor(
+ () => {
+ expect(screen.getByText("Team Settings")).toBeInTheDocument();
+ },
+ // This is a workaround to fix the flaky test issue. TODO: Remove this once we have a better solution.
+ { timeout: 10000 },
+ );
const editButton = screen.getByRole("button", { name: "Edit Settings" });
act(() => {
fireEvent.click(editButton);
});
- await waitFor(() => {
- expect(screen.getByLabelText("Models")).toBeInTheDocument();
- });
+ await waitFor(
+ () => {
+ expect(screen.getByLabelText("Models")).toBeInTheDocument();
+ },
+ // This is a workaround to fix the flaky test issue. TODO: Remove this once we have a better solution.
+ { timeout: 10000 },
+ );
const allProxyModelsOption = screen.queryByText("All Proxy Models");
expect(allProxyModelsOption).not.toBeInTheDocument();