@@ -27,7 +27,7 @@ import (
2727 . "github.com/onsi/ginkgo/v2"
2828 . "github.com/onsi/gomega"
2929 "k8s.io/apimachinery/pkg/api/meta"
30- v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
30+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3131 "k8s.io/apimachinery/pkg/types"
3232 ctrl "sigs.k8s.io/controller-runtime"
3333
@@ -90,7 +90,7 @@ var _ = Describe("HypervisorServiceController", func() {
9090
9191 By ("Creating a blank Hypervisor resource" )
9292 hypervisor := & kvmv1.Hypervisor {
93- ObjectMeta : v1 .ObjectMeta {
93+ ObjectMeta : metav1 .ObjectMeta {
9494 Name : hypervisorName .Name ,
9595 Namespace : hypervisorName .Namespace ,
9696 },
@@ -116,10 +116,10 @@ var _ = Describe("HypervisorServiceController", func() {
116116 Expect (tc .Client .Get (ctx , hypervisorName , hypervisor )).To (Succeed ())
117117 hypervisor .Status .ServiceID = "1234"
118118 meta .SetStatusCondition (& hypervisor .Status .Conditions ,
119- v1 .Condition {
119+ metav1 .Condition {
120120 Type : ConditionTypeOnboarding ,
121- Status : v1 .ConditionFalse ,
122- Reason : v1 .StatusSuccess ,
121+ Status : metav1 .ConditionFalse ,
122+ Reason : metav1 .StatusSuccess ,
123123 Message : "random text" ,
124124 },
125125 )
@@ -146,6 +146,16 @@ var _ = Describe("HypervisorServiceController", func() {
146146 Expect (tc .Client .Get (ctx , hypervisorName , updated )).To (Succeed ())
147147 Expect (meta .IsStatusConditionFalse (updated .Status .Conditions , kvmv1 .ConditionTypeHypervisorDisabled )).To (BeTrue ())
148148 })
149+
150+ It ("should set the ConditionTypeReady to true" , func () {
151+ updated := & kvmv1.Hypervisor {}
152+ Expect (tc .Client .Get (ctx , hypervisorName , updated )).To (Succeed ())
153+ Expect (updated .Status .Conditions ).To (ContainElement (
154+ SatisfyAll (
155+ HaveField ("Type" , kvmv1 .ConditionTypeReady ),
156+ HaveField ("Status" , metav1 .ConditionTrue ),
157+ )))
158+ })
149159 }) // Spec.Maintenance=""
150160 })
151161
@@ -168,6 +178,16 @@ var _ = Describe("HypervisorServiceController", func() {
168178 Expect (tc .Client .Get (ctx , hypervisorName , updated )).To (Succeed ())
169179 Expect (meta .IsStatusConditionTrue (updated .Status .Conditions , kvmv1 .ConditionTypeHypervisorDisabled )).To (BeTrue ())
170180 })
181+
182+ It ("should set the ConditionTypeReady to false" , func () {
183+ updated := & kvmv1.Hypervisor {}
184+ Expect (tc .Client .Get (ctx , hypervisorName , updated )).To (Succeed ())
185+ Expect (updated .Status .Conditions ).To (ContainElement (
186+ SatisfyAll (
187+ HaveField ("Type" , kvmv1 .ConditionTypeReady ),
188+ HaveField ("Status" , metav1 .ConditionFalse ),
189+ )))
190+ })
171191 }) // Spec.Maintenance="<mode>"
172192 }
173193
0 commit comments