Skip to content

Latest commit

Β 

History

History
76 lines (62 loc) Β· 2.89 KB

File metadata and controls

76 lines (62 loc) Β· 2.89 KB

Testing yanet-operator

πŸ“Š Current Status

  • Coverage: ~90% overall (89.2% helpers, 92.1% manifests, ~36% controller)
  • Unit tests: 60+ tests, all passing
  • Integration tests: 4 Ginkgo scenarios
  • CI/CD: GitHub Actions (tests + Docker + Helm)

πŸ§ͺ Running Tests

Quick Start (Docker-based, recommended)

make test-unit              # Unit tests only
make test-docker            # All tests in Docker
make test-docker-race       # With race detector

Local (requires Go 1.26.2+)

make test                   # All tests with coverage
make test-race              # With race detector
make lint                   # Code quality checks

πŸ“ Test Structure

internal/
β”œβ”€β”€ helpers/
β”‚   β”œβ”€β”€ helpers_test.go         # GetLabeledNodes, DeploymentDiff edge cases, GetNodes
β”‚   β”œβ”€β”€ http_getters_test.go    # HTTP client tests
β”‚   └── resolve_v2_test.go      # v2: FindBoxType, ResolveBoxComponent, EnabledComponentsForBox
β”œβ”€β”€ manifests/
β”‚   β”œβ”€β”€ builder_v2_test.go      # v2: BuildDeployments, NUMA fan-out, patches
β”‚   β”œβ”€β”€ service_v2_test.go      # v2: BuildServices, ServicePlan
β”‚   β”œβ”€β”€ patcher_test.go         # ApplyPatches, PatchRegistry
β”‚   β”œβ”€β”€ dataplane_test.go       # v1: DeploymentForDataplane
β”‚   β”œβ”€β”€ controlplane_test.go    # v1: DeploymentForControlplane
β”‚   β”œβ”€β”€ announcer_test.go       # v1: DeploymentForAnnouncer
β”‚   β”œβ”€β”€ bird_test.go            # v1: DeploymentForBird
β”‚   └── helpers_test.go         # Labels, Tolerations, Volumes
└── controller/
    β”œβ”€β”€ yanet_reconciler_v2_test.go          # v2: reconcileYanetV2
    β”œβ”€β”€ yanet_reconciler_v2_h9_test.go       # v2: H9 edge cases
    β”œβ”€β”€ yanet_reconciler_v2_hardening_test.go # v2: hardening scenarios
    β”œβ”€β”€ yanet_reconciler_test.go             # v1: checkUpdateRequeue
    β”œβ”€β”€ yanet_conditions_test.go             # computeConditions
    β”œβ”€β”€ yanet_conditions_v2_test.go          # v2 conditions
    β”œβ”€β”€ node_deletion_test.go                # handleNodeDeletion
    └── yanet_controller_integration_test.go # Ginkgo integration tests

🎯 Coverage Goals

Package Current Target Status
manifests 92.1% 90%+ βœ…
helpers 89.2% 70%+ βœ…
controller ~36% (v1 tests, v2 tests growing) 70%+ πŸ”„

πŸš€ Next Steps

Priority 1: Controller Coverage

  • Add more unit tests for reconciler logic
  • Increase controller package coverage to 70%+

Priority 2: E2E Testing

  • Add end-to-end tests with kind cluster
  • Test webhook validation end-to-end

πŸ“š References