mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-29 06:33:28 +00:00
test(e2e): backport three stale e2e test fixes from main to rc/1.106.0 (#47229)
Takes the main version of each file, which is the rc copy plus one main commit: - test_image_generation_e2e.py from #46998 (Nova Canvas reached end of life) - test_bedrock_converse.py from #45530 (ask an uncached model once more) - migratedPages.spec.ts from #45863 (/ui/ lands on Home since #45858)
This commit is contained in:
parent
d50932dea7
commit
955bdaafa8
3 changed files with 25 additions and 11 deletions
|
|
@ -15,7 +15,7 @@ The (feature, provider) for this cell is inferred from the file path by
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any, Mapping, Optional
|
||||
from typing import Any, Dict, Final, Mapping, Optional, Sequence
|
||||
|
||||
import pytest
|
||||
|
||||
|
|
@ -23,6 +23,7 @@ from e2e_metadata import Capability, Domain, Mode, Provider, Route, Subject, met
|
|||
from claude_code._env import require_proxy
|
||||
from claude_code.cli_driver import (
|
||||
ClaudeCLIError,
|
||||
ModelResult,
|
||||
failure_diagnostic,
|
||||
run_claude_models_parallel,
|
||||
)
|
||||
|
|
@ -62,12 +63,21 @@ def test_prompt_caching_5m_bedrock_converse(compat_result):
|
|||
upstream usage block surfaces a non-zero cache token count."""
|
||||
base_url, api_key = require_proxy(compat_result)
|
||||
|
||||
outcomes = run_claude_models_parallel(
|
||||
models=BEDROCK_CONVERSE_MODELS,
|
||||
prompt="Reply with the single word 'pong' and nothing else.",
|
||||
base_url=base_url,
|
||||
api_key=api_key,
|
||||
def run(models: Sequence[str]) -> Dict[str, ModelResult]:
|
||||
return run_claude_models_parallel(
|
||||
models=models,
|
||||
prompt="Reply with the single word 'pong' and nothing else.",
|
||||
base_url=base_url,
|
||||
api_key=api_key,
|
||||
)
|
||||
|
||||
first: Final = run(BEDROCK_CONVERSE_MODELS)
|
||||
uncached: Final = tuple(
|
||||
model
|
||||
for model, outcome in first.items()
|
||||
if not isinstance(outcome, ClaudeCLIError) and outcome.exit_code == 0 and _cache_tokens(outcome.usage) <= 0
|
||||
)
|
||||
outcomes: Final = {**first, **run(uncached)} if uncached else first
|
||||
|
||||
failures = []
|
||||
for model in BEDROCK_CONVERSE_MODELS:
|
||||
|
|
|
|||
|
|
@ -24,7 +24,10 @@ from sdk_clients import SdkClients
|
|||
pytestmark = pytest.mark.e2e
|
||||
|
||||
OPENAI_IMAGE_BACKEND: Final = "openai/gpt-image-1-mini"
|
||||
BEDROCK_IMAGE_BACKEND: Final = "bedrock/amazon.nova-canvas-v1:0"
|
||||
BEDROCK_IMAGE_BACKEND: Final = "bedrock/stability.stable-image-core-v1:1"
|
||||
# Nova Canvas reached end of life on 2026-09-30. Stable Image Core is active on Bedrock only in us-west-2:
|
||||
# https://docs.aws.amazon.com/bedrock/latest/userguide/model-card-stability-ai-stable-image-core-1-0.html (2026-10-16)
|
||||
BEDROCK_IMAGE_REGION: Final = "us-west-2"
|
||||
|
||||
|
||||
class _OptionalImageBody(BaseModel):
|
||||
|
|
@ -96,10 +99,10 @@ class TestImageGeneration:
|
|||
model=BEDROCK_IMAGE_BACKEND,
|
||||
aws_access_key_id="os.environ/AWS_ACCESS_KEY_ID",
|
||||
aws_secret_access_key="os.environ/AWS_SECRET_ACCESS_KEY",
|
||||
aws_region_name="os.environ/AWS_REGION",
|
||||
aws_region_name=BEDROCK_IMAGE_REGION,
|
||||
),
|
||||
)
|
||||
images = sdk.openai(key).images.generate(model=model, prompt="Draw a cute cat", n=1, size="1024x1024")
|
||||
images = sdk.openai(key).images.generate(model=model, prompt="Draw a cute cat")
|
||||
_assert_image_returned(images)
|
||||
|
||||
@pytest.mark.skip(reason="stage red: product gap, /v1/images/generations 500s (aimage_generation TypeError) on missing prompt instead of 400")
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import { proxyIsPremium } from "../../helpers/premium";
|
|||
|
||||
const ROOT = (process.env.SERVER_ROOT_PATH ?? "").replace(/\/+$/, "");
|
||||
const apiKeys = MIGRATED_E2E_PAGES["api-keys"];
|
||||
const home: MigratedPage = { segment: "", linkName: "Home", content: { role: "heading", name: "Home" } };
|
||||
|
||||
async function expectContent(page: Page, destination: MigratedPage): Promise<void> {
|
||||
await expect(sidebarLink(page, apiKeys.linkName)).toBeVisible({ timeout: 20_000 });
|
||||
|
|
@ -40,7 +41,7 @@ test.describe("App Router migrated pages", () => {
|
|||
const landing = await page.goto(`${ROOT}/ui/`);
|
||||
expect(landing?.ok(), "dashboard document loads successfully").toBe(true);
|
||||
await dismissFeedbackPopup(page);
|
||||
await expectContent(page, apiKeys);
|
||||
await expectContent(page, home);
|
||||
|
||||
await navigateToDestination(page, destination);
|
||||
|
||||
|
|
@ -63,7 +64,7 @@ test.describe("App Router migrated pages", () => {
|
|||
const landing = await page.goto(`${ROOT}/ui/`);
|
||||
expect(landing?.ok(), "dashboard document loads successfully").toBe(true);
|
||||
await dismissFeedbackPopup(page);
|
||||
await expectContent(page, apiKeys);
|
||||
await expectContent(page, home);
|
||||
|
||||
for (const destination of [apiKeys, MIGRATED_E2E_PAGES.models, apiKeys]) {
|
||||
await navigateToDestination(page, destination);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue