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
2 changes: 1 addition & 1 deletion tests/llm/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ def llm_availability_check(request):
braintrust_api_key = os.environ.get("BRAINTRUST_API_KEY")
if braintrust_api_key:
print(
"✓ Braintrust is enabled - traces and results will be available at braintrust.dev"
f"✓ Braintrust is enabled - traces and results will be available at {get_braintrust_url()}" # type: ignore[no-untyped-call]
)
else:
print(
Expand Down
19 changes: 17 additions & 2 deletions tests/llm/utils/test_case_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
from typing import Any, List, Literal, Optional, TypeVar, Union, cast

import pytest
from pydantic import BaseModel, TypeAdapter, ConfigDict
from pydantic import BaseModel, TypeAdapter, ValidationError, ConfigDict
from holmes.core.models import InvestigateRequest, WorkloadHealthRequest
from holmes.core.prompt import append_file_to_user_prompt

from holmes.core.tool_calling_llm import ResourceInstructions
from tests.llm.utils.constants import ALLOWED_EVAL_TAGS
from tests.llm.utils.constants import ALLOWED_EVAL_TAGS, get_allowed_tags_list


def read_file(file_path: Path):
Expand Down Expand Up @@ -187,6 +187,7 @@ def load_test_cases(self) -> List[HolmesTestCase]:
test_case = TypeAdapter(AskHolmesTestCase).validate_python(
config_dict
)

elif self._test_cases_folder.name == "test_investigate":
config_dict["investigate_request"] = load_investigate_request(
test_case_folder
Expand Down Expand Up @@ -222,6 +223,20 @@ def load_test_cases(self) -> List[HolmesTestCase]:

logging.debug(f"Successfully loaded test case {test_case_id}")
test_cases.append(test_case)
except ValidationError as e:
problematic_tags = []
for error in e.errors():
if error["type"] == "literal_error" and "tags" in str(error["loc"]):
problematic_tags.append(error["input"])

if problematic_tags:
error_msg = (
f"VALIDATION ERROR in test case: {test_case_folder.name}\n"
)
error_msg += f"Problematic tags: {', '.join(problematic_tags)}\n"
error_msg += f"Allowed tags; {get_allowed_tags_list()}"
print(error_msg)
raise e
except FileNotFoundError:
logging.debug(
f"Folder {self._test_cases_folder}/{test_case_id} ignored because it is missing a {CONFIG_FILE_NAME} file."
Expand Down