test(e2e): fix MCP tool search hit matching and the retired Bedrock image model (#46998)

* test(e2e): compare parsed MCP tool search hit names instead of raw text

* test(e2e): move Bedrock image generation off the retired Nova Canvas model
This commit is contained in:
yuneng-jiang 2026-10-16 15:45:39 -07:00 • committed by GitHub
parent 910c30381b
commit e9a8581a02
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 23 additions and 5 deletions

View file

@ -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")

View file

@ -3,6 +3,7 @@ from __future__ import annotations
from typing import Final
import pytest
from pydantic import BaseModel, ConfigDict, TypeAdapter
from datadog_mcp import SEARCH_LOGS_TOOL, register_datadog_mcp
from e2e_config import provider_edge_base, unique_marker
from e2e_http import unwrap
@ -17,6 +18,19 @@ MCP_TOOL_SEARCH_TOOL_NAME: Final = "mcp_tool_search"
OVERSIZED_DESCRIPTION: Final = f"OVERSIZED {'weather ' * 12_000}"
class _SearchHit(BaseModel):
model_config = ConfigDict(frozen=True)
name: str
_SEARCH_HITS: Final = TypeAdapter(tuple[_SearchHit, ...])
def _hits_tool(hits: tuple[_SearchHit, ...], tool_name: str) -> bool:
return any(hit.name.endswith(f"-{tool_name}") for hit in hits)
class TestMcpToolSearch:
@pytest.mark.covers("mcp.tool_search.api_key.oversized_description_omitted")
def test_native_tool_search_omits_oversized_description(
@ -82,5 +96,6 @@ class TestMcpToolSearch:
)
assert result.is_error is not True, result.all_text
assert normal_tool_name in result.all_text
assert oversized_tool_name not in result.all_text
hits: Final = _SEARCH_HITS.validate_json(result.all_text)
assert _hits_tool(hits, normal_tool_name), hits
assert not _hits_tool(hits, oversized_tool_name), hits