Skip to content

Conversation

@alxkm
Copy link
Contributor

@alxkm alxkm commented Aug 7, 2025

This PR adds comprehensive unit test coverage for ModelObservationContext and ModelUsageMetricsGenerator classes, focusing on validation, edge cases, and metrics generation scenarios.

Changes Made

ModelObservationContext Tests:

  • Added validation tests for empty and whitespace-only operation types and providers
  • Added tests for different AI provider types (Ollama, OpenAI, Anthropic)
  • Added generic type testing with complex object types (Integer, Boolean)
  • Added getter/setter behavior validation including multiple response updates
  • Added edge cases for empty string requests and responses

ModelUsageMetricsGenerator Tests:

  • Added test for zero token usage metrics generation
  • Added test for null prompt/generation tokens with valid total tokens
  • Added validation of metric registry behavior and counter values
  • Added testing of different token type tags

Test Coverage Improvements

Validation: Empty/null/whitespace parameter handling
Edge Cases: Zero values, null combinations, empty strings
Provider Support: Multiple AI provider validation
Metrics Generation: Token usage tracking and registry validation
Type Safety: Generic type parameter testing

… ModelUsageMetricsGenerator

Signed-off-by: Alex Klimenko <[email protected]>
@alxkm alxkm changed the title test: Add comprehensive test coverage for ModelObservationContext and ModelUsageMetricsGenerator test: Add comprehensive test coverage for ModelObservationContext and ModelUsageMetricsGenerator Aug 7, 2025
@sobychacko
Copy link
Contributor

Merged via c893629.

@sobychacko sobychacko closed this Aug 7, 2025
@sobychacko sobychacko added this to the 1.1.0.M1 milestone Aug 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants