Skip to content

[AgentOps][Test] Add unit tests for backend apps [1/n]#445

Merged
XinweiHe merged 2 commits intopivot/agentopsfrom
xinwei_add_unit_tests_v1
Feb 9, 2026
Merged

[AgentOps][Test] Add unit tests for backend apps [1/n]#445
XinweiHe merged 2 commits intopivot/agentopsfrom
xinwei_add_unit_tests_v1

Conversation

@XinweiHe
Copy link
Collaborator

@XinweiHe XinweiHe commented Feb 9, 2026

Summary

Fixes #444

Type of Change

  • feat - A new feature
  • fix - A bug fix
  • docs - Documentation only changes
  • style - Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
  • refactor - A code change that neither fixes a bug nor adds a feature
  • perf - A code change that improves performance
  • test - Adding missing tests or correcting existing tests
  • build - Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
  • ci - Changes to our Cl configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
  • chore - Other changes that don't modify sc or test files
  • revert - Reverts a previous commit
  • security - A security fix or improvement
  • github - Changes to our GitHub configuration files and scripts
  • other (please describe):

Details

Screenshots / Recordings (if applicable)

Screenshot 2026-02-09 at 2 02 00 PM

Checklist

  • I have read the CONTRIBUTING.md
  • I have added/updated tests where applicable
  • I have added screenshots or recordings for UI changes (if applicable)
  • I have updated documentation where necessary

@XinweiHe XinweiHe requested a review from a team as a code owner February 9, 2026 22:02
@greptile-apps
Copy link

greptile-apps bot commented Feb 9, 2026

Greptile Overview

Greptile Summary

This PR adds comprehensive unit tests for the backend application as part 1/n of a testing initiative. The changes include:

  • Added pytest configuration and test dependencies (pytest-cov for coverage, respx for mocking HTTP calls)
  • Created reusable test fixtures for OTEL payload generation
  • Added unit tests for database client row-building logic
  • Added tests for REST API endpoints (auth, traces ingestion, trace queries, user queries)
  • Added tests for worker tasks (OTEL transformation, ingestion, token pricing/usage)
  • Configured singleton cleanup between tests to prevent test pollution

All tests use proper mocking to avoid requiring external dependencies (ClickHouse, S3, Celery, Next.js auth service). Test coverage is comprehensive with happy path, edge cases, and error scenarios.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The changes only add test files and test configuration without modifying any production code. All tests use proper mocking strategies and follow pytest best practices. The test infrastructure is well-designed with fixtures, proper cleanup, and comprehensive coverage.
  • No files require special attention

Important Files Changed

Filename Overview
pyproject.toml Added pytest configuration and test dependencies (pytest-cov, respx), configured test paths and coverage reporting
tests/rest/test_auth_deps.py Unit tests for authentication dependencies with comprehensive coverage of success/failure scenarios using respx to mock HTTP calls
tests/rest/test_public_traces.py Tests for public traces ingestion endpoint covering protobuf decoding, S3 upload, Celery task enqueueing, and error handling
tests/rest/test_traces_router.py Tests for trace query endpoints with mocked dependencies, covering list/detail views, pagination, filters, and error cases
tests/worker/test_ingest_tasks.py Unit tests for Celery task logic with mocked S3 and ClickHouse, validates download, transform, and insert operations
tests/worker/test_otel_transform.py Comprehensive tests for OTEL to ClickHouse transformation logic covering ID decoding, attribute extraction, span kind detection, and full transform pipeline

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

6 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@XinweiHe XinweiHe merged commit 4a34d49 into pivot/agentops Feb 9, 2026
4 checks passed
@XinweiHe XinweiHe deleted the xinwei_add_unit_tests_v1 branch February 9, 2026 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant