Skip to content

Conversation

dmartinol
Copy link
Collaborator

First bunch of tests to address #1749
It also depends on #2016 which should be committed first

  • Fixes never-ending reconciliation loop by comparing the status fields instead of always updating the updated status (this would cause an immediate reconciliation)
  • Adds a test/e2e/operator/registry_lifecycle_test.go initial test to prove the capabilities of ginkgo as the testing framework for orchestrated workflows

Questions to be answered:

  • Where do we keep this files, is the current location suitable?
  • Should we call them from the operator-e2e-test task?

dmartinol and others added 7 commits September 26, 2025 17:19
- Create Ginkgo-based test suite for operator testing
- Add comprehensive test helpers for MCPRegistry operations
- Include test fixtures with sample YAML manifests
- Set up Kubernetes test environment with envtest support
- Add namespace isolation and cleanup utilities

🤖 Generated with [Claude Code](https://claude.ai/code)

Signed-off-by: Daniele Martinoli <dmartino@redhat.com>
Co-authored-by: Claude <noreply@anthropic.com>
- Create test suite with proper Kubernetes environment setup
- Add specialized helper utilities for MCPRegistry operations
- Implement ConfigMap test helpers for registry data validation
- Add status validation helpers for phase and condition checking
- Create timing utilities with proper timeout configurations
- Add test data factories for generating test resources
- Include builder patterns for fluent resource construction
- Support both ToolHive and upstream MCP registry formats
- Add comprehensive test fixtures and scenarios

🤖 Generated with [Claude Code](https://claude.ai/code)

Signed-off-by: Daniele Martinoli <dmartino@redhat.com>
Co-authored-by: Claude <noreply@anthropic.com>
- Fix finalizer removal using Patch instead of Update to avoid resource conflicts
- Update registry data structure to match expected schema (add required fields: tier, status, tools, image)
- Add proper registry deletion waiting in cleanup to prevent namespace deletion issues
- Fix lint errors by removing dot imports from non-test files
- Add comprehensive MCPRegistry lifecycle test coverage
- Improve error handling and logging in test helpers

Signed-off-by: Daniele Martinoli <dmartino@redhat.com>
Co-authored-by: Claude <noreply@anthropic.com>

🤖 Generated with [Claude Code](https://claude.ai/code)
… errors)

Signed-off-by: Daniele Martinoli <dmartino@redhat.com>
… correct initial status"

Signed-off-by: Daniele Martinoli <dmartino@redhat.com>
- Introduced environment variable handling for KUBEBUILDER_ASSETS
- Added warning for missing kubebuilder assets to improve test reliability
- Updated test environment configuration to include BinaryAssetsDirectory

This change aims to streamline the e2e testing process and provide clearer feedback on asset availability.

Signed-off-by: Daniele Martinoli <dmartino@redhat.com>
- initial draft of e2e tests

Signed-off-by: Daniele Martinoli <dmartino@redhat.com>
@dmartinol dmartinol requested a review from jhrozek September 26, 2025 15:28
Copy link

codecov bot commented Sep 26, 2025

Codecov Report

❌ Patch coverage is 21.42857% with 253 lines in your changes missing coverage. Please review.
✅ Project coverage is 47.80%. Comparing base (a49985e) to head (12ec9f6).

Files with missing lines Patch % Lines
...ator/pkg/mcpregistrystatus/mocks/mock_collector.go 0.00% 77 Missing ⚠️
...thv-operator/controllers/mcpregistry_controller.go 0.00% 66 Missing ⚠️
cmd/thv-operator/api/v1alpha1/mcpregistry_types.go 0.00% 32 Missing ⚠️
cmd/thv-operator/pkg/sync/manager.go 25.58% 32 Missing ⚠️
...md/thv-operator/pkg/mcpregistrystatus/collector.go 53.84% 24 Missing ⚠️
cmd/thv-operator/pkg/registryapi/manager.go 0.00% 17 Missing ⚠️
...thv-operator/pkg/registryapi/mocks/mock_manager.go 0.00% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2017      +/-   ##
==========================================
- Coverage   47.91%   47.80%   -0.11%     
==========================================
  Files         233      235       +2     
  Lines       29172    29273     +101     
==========================================
+ Hits        13978    13995      +17     
- Misses      14166    14246      +80     
- Partials     1028     1032       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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