Skip to content

Commit 7b2f4f8

Browse files
committed
Update test
1 parent 89c11e2 commit 7b2f4f8

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

internal/controller/hypervisor_maintenance_controller_test.go

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ var _ = Describe("HypervisorMaintenanceController", func() {
160160
}) // Spec.Maintenance=""
161161
})
162162

163-
for _, mode := range []string{"auto", "manual", "ha"} {
163+
for _, mode := range []string{"auto", "manual"} {
164164
Context(fmt.Sprintf("Spec.Maintenance=\"%v\"", mode), func() {
165165
BeforeEach(func(ctx SpecContext) {
166166
hypervisor := &kvmv1.Hypervisor{}
@@ -182,6 +182,23 @@ var _ = Describe("HypervisorMaintenanceController", func() {
182182
}) // Spec.Maintenance="<mode>"
183183
}
184184

185+
Context("Spec.Maintenance=\"ha\"", func() {
186+
BeforeEach(func(ctx SpecContext) {
187+
hypervisor := &kvmv1.Hypervisor{}
188+
Expect(k8sClient.Get(ctx, hypervisorName, hypervisor)).To(Succeed())
189+
hypervisor.Spec.Maintenance = kvmv1.MaintenanceHA
190+
Expect(k8sClient.Update(ctx, hypervisor)).To(Succeed())
191+
})
192+
193+
It("should not call the Nova API (kvm-ha-service owns enable/disable for ha mode)", func(ctx SpecContext) {
194+
// The controller takes no action for ha mode; kvm-ha-service handles it.
195+
// Verify the hypervisor is still accessible and no condition is set by this controller.
196+
updated := &kvmv1.Hypervisor{}
197+
Expect(k8sClient.Get(ctx, hypervisorName, updated)).To(Succeed())
198+
Expect(meta.IsStatusConditionTrue(updated.Status.Conditions, kvmv1.ConditionTypeHypervisorDisabled)).To(BeFalse())
199+
})
200+
}) // Spec.Maintenance="ha"
201+
185202
Describe("Eviction reconciliation", func() {
186203
Context("Spec.Maintenance=\"\"", func() {
187204
BeforeEach(func(ctx SpecContext) {
@@ -227,8 +244,6 @@ var _ = Describe("HypervisorMaintenanceController", func() {
227244
Expect(k8sClient.Get(ctx, hypervisorName, hypervisor)).To(Succeed())
228245
hypervisor.Spec.Maintenance = "ha"
229246
Expect(k8sClient.Update(ctx, hypervisor)).To(Succeed())
230-
expectedBody := `{"disabled_reason": "Hypervisor CRD: spec.maintenance=ha", "status": "disabled"}`
231-
mockServiceUpdate(expectedBody)
232247
})
233248
It("should not create an eviction resource", func(ctx SpecContext) {
234249
eviction := &kvmv1.Eviction{}

0 commit comments

Comments
 (0)