Skip to content

Extend tests#243

Open
fwiesel wants to merge 11 commits intomainfrom
extend-tests
Open

Extend tests#243
fwiesel wants to merge 11 commits intomainfrom
extend-tests

Conversation

@fwiesel
Copy link
Contributor

@fwiesel fwiesel commented Feb 19, 2026

No description provided.

Add test for
- GetAggregates API failure scenario
- AddToAggregate failure scenario
- RemoveFromAggregate failure scenario
- error condition when status doesn't change
- Group tests into 'Happy Path', 'Guard Conditions', and 'Failure Modes'
- Add JustBeforeEach for automatic Reconcile execution in success paths
- Extract sharedErrorConditionChecks function for DRY validation

Verified that coverage remains unchanged
Added test for
- lifecycle not enabled
- maintenance not set to termination
- GetHypervisor failure
- hypervisor with running VMs
- GetAggregates failure
- RemoveFromAggregate failure
- DeleteService failure
- GetResourceProvider failure
- CleanupResourceProvider failure

Fixed typo in aggregate list (note-test -> node-test)
@fwiesel fwiesel marked this pull request as ready for review February 19, 2026 16:14
@github-actions
Copy link

Merging this branch will increase overall coverage

Impacted Packages Coverage Δ 🤖
github.com/cobaltcore-dev/openstack-hypervisor-operator/internal/controller 61.37% (+5.29%) 👍

Coverage by file

Changed unit test files

  • github.com/cobaltcore-dev/openstack-hypervisor-operator/internal/controller/aggregates_controller_test.go
  • github.com/cobaltcore-dev/openstack-hypervisor-operator/internal/controller/decomission_controller_test.go
  • github.com/cobaltcore-dev/openstack-hypervisor-operator/internal/controller/eviction_controller_test.go
  • github.com/cobaltcore-dev/openstack-hypervisor-operator/internal/controller/gardener_node_lifecycle_controller_test.go
  • github.com/cobaltcore-dev/openstack-hypervisor-operator/internal/controller/hypervisor_controller_test.go
  • github.com/cobaltcore-dev/openstack-hypervisor-operator/internal/controller/hypervisor_maintenance_controller_test.go
  • github.com/cobaltcore-dev/openstack-hypervisor-operator/internal/controller/hypervisor_taint_controller_test.go
  • github.com/cobaltcore-dev/openstack-hypervisor-operator/internal/controller/node_certificate_controller_test.go

- Group tests into 'Happy Path', 'Guard Conditions', and 'Failure Modes'
- Extract sharedDecommissioningErrorCheck function for DRY validation
- Move common setup to shared BeforeEach in Failure Modes
Added test for
- hypervisor not existing (IgnoreNotFound behavior)
- lifecycle not enabled
- node terminating and offboarded (disableInstanceHA path)

Fixed DeferCleanup to use IgnoreNotFound for deleted hypervisors
Add test for
- non-existent hypervisor (not found case)
- no-changes scenario (early return path)
Added test for
- node lookup with NotFound (IgnoreNotFound behavior)
- node with internal IP address
Added test for
- non-existent hypervisor (IgnoreNotFound)
- hypervisor still onboarding (early return)
- empty ServiceID (skip compute service)
Add test for
- node with various address types (DNS, IPs)
- node without hypervisor label
- non-existent node (not found case)
- address handling and empty address filtering
- Separate 'API validation' from 'Reconciliation' tests
- Group reconciliation tests into 'Happy Path' and 'Failure Modes'
- Move shared hypervisor setup to outer BeforeEach
- Improve test descriptions with clearer context naming
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

Comments