@@ -178,6 +178,14 @@ var _ = Describe("BIOSSettings Controller", func() {
178178 Eventually (Object (server )).Should (
179179 HaveField ("Spec.BIOSSettingsRef.Name" , biosSettingsV2 .Name ),
180180 )
181+ By ("Deleting the BIOSSettings V2 (new)" )
182+ Expect (k8sClient .Delete (ctx , biosSettingsV2 )).To (Succeed ())
183+ Eventually (Object (server )).Should (
184+ HaveField ("Spec.BIOSSettingsRef" , BeNil ()),
185+ )
186+ Eventually (Object (server )).Should (
187+ HaveField ("Status.State" , Not (Equal (metalv1alpha1 .ServerStateMaintenance ))),
188+ )
181189 })
182190
183191 It ("should move to completed if no bios setting changes to referred server" , func (ctx SpecContext ) {
@@ -239,6 +247,9 @@ var _ = Describe("BIOSSettings Controller", func() {
239247 Eventually (Object (server )).Should (
240248 HaveField ("Spec.BIOSSettingsRef" , BeNil ()),
241249 )
250+ Eventually (Object (server )).Should (
251+ HaveField ("Status.State" , Not (Equal (metalv1alpha1 .ServerStateMaintenance ))),
252+ )
242253 })
243254
244255 It ("Should request maintenance when changing power status of server, even if bios settings update does not need it" , func (ctx SpecContext ) {
@@ -386,6 +397,10 @@ var _ = Describe("BIOSSettings Controller", func() {
386397
387398 // cleanup
388399 Expect (k8sClient .Delete (ctx , serverClaim )).Should (Succeed ())
400+ Eventually (Object (server )).Should (SatisfyAll (
401+ HaveField ("Status.State" , Not (Equal (metalv1alpha1 .ServerStateMaintenance ))),
402+ HaveField ("Status.State" , Not (Equal (metalv1alpha1 .ServerStateReserved ))),
403+ ))
389404 })
390405
391406 It ("should create maintenance if setting update needs reboot" , func (ctx SpecContext ) {
@@ -519,7 +534,12 @@ var _ = Describe("BIOSSettings Controller", func() {
519534 Consistently (Get (serverMaintenance )).Should (Satisfy (apierrors .IsNotFound ))
520535
521536 // cleanup
537+ Expect (k8sClient .Delete (ctx , biosSettings )).Should (Succeed ())
522538 Expect (k8sClient .Delete (ctx , serverClaim )).Should (Succeed ())
539+ Eventually (Object (server )).Should (SatisfyAll (
540+ HaveField ("Status.State" , Not (Equal (metalv1alpha1 .ServerStateMaintenance ))),
541+ HaveField ("Status.State" , Not (Equal (metalv1alpha1 .ServerStateReserved ))),
542+ ))
523543 })
524544
525545 It ("should update setting if server is in available state" , func (ctx SpecContext ) {
@@ -612,6 +632,9 @@ var _ = Describe("BIOSSettings Controller", func() {
612632 Eventually (Object (server )).Should (
613633 HaveField ("Spec.BIOSSettingsRef" , BeNil ()),
614634 )
635+ Eventually (Object (server )).Should (
636+ HaveField ("Status.State" , Not (Equal (metalv1alpha1 .ServerStateMaintenance ))),
637+ )
615638 })
616639
617640 It ("should wait for upgrade and reconcile when biosSettings version is correct" , func (ctx SpecContext ) {
@@ -735,6 +758,9 @@ var _ = Describe("BIOSSettings Controller", func() {
735758
736759 // cleanup
737760 Expect (k8sClient .Delete (ctx , serverClaim )).To (Succeed ())
761+ Eventually (Object (server )).Should (
762+ HaveField ("Status.State" , Not (Equal (metalv1alpha1 .ServerStateMaintenance ))),
763+ )
738764 })
739765
740766 It ("should allow retry using annotation" , func (ctx SpecContext ) {
@@ -787,6 +813,9 @@ var _ = Describe("BIOSSettings Controller", func() {
787813
788814 Expect (k8sClient .Delete (ctx , biosSettings )).To (Succeed ())
789815 Eventually (Get (biosSettings )).Should (Satisfy (apierrors .IsNotFound ))
816+ Eventually (Object (server )).Should (
817+ HaveField ("Status.State" , Not (Equal (metalv1alpha1 .ServerStateMaintenance ))),
818+ )
790819 })
791820})
792821
@@ -996,6 +1025,10 @@ var _ = Describe("BIOSSettings Controller with BMCRef BMC", func() {
9961025
9971026 // cleanup
9981027 Expect (k8sClient .Delete (ctx , serverClaim )).Should (Succeed ())
1028+ Eventually (Object (server )).Should (SatisfyAll (
1029+ HaveField ("Status.State" , Not (Equal (metalv1alpha1 .ServerStateMaintenance ))),
1030+ HaveField ("Status.State" , Not (Equal (metalv1alpha1 .ServerStateReserved ))),
1031+ ))
9991032 })
10001033})
10011034
@@ -1098,6 +1131,9 @@ var _ = Describe("BIOSSettings Sequence Controller", func() {
10981131
10991132 By ("Deleting the BIOSSetting" )
11001133 Expect (k8sClient .Delete (ctx , biosSettings )).To (Succeed ())
1134+ Eventually (Object (server )).Should (
1135+ HaveField ("Status.State" , Not (Equal (metalv1alpha1 .ServerStateMaintenance ))),
1136+ )
11011137 })
11021138
11031139 It ("Should fail if duplicate keys in names or settings found" , func (ctx SpecContext ) {
@@ -1202,6 +1238,11 @@ var _ = Describe("BIOSSettings Sequence Controller", func() {
12021238
12031239 By ("Deleting the biosSettings2" )
12041240 Expect (k8sClient .Delete (ctx , biosSettings2 )).To (Succeed ())
1241+ By ("Deleting the biosSettings" )
1242+ Expect (k8sClient .Delete (ctx , biosSettings )).To (Succeed ())
1243+ Eventually (Object (server )).Should (
1244+ HaveField ("Status.State" , Not (Equal (metalv1alpha1 .ServerStateMaintenance ))),
1245+ )
12051246 })
12061247
12071248 It ("Should successfully apply sequence of different settings and reconcile from applied state" , func (ctx SpecContext ) {
@@ -1243,6 +1284,12 @@ var _ = Describe("BIOSSettings Sequence Controller", func() {
12431284 By ("Ensuring that the BIOSSettings conditions are updated" )
12441285 ensureBiosSettingsFlowCondition (biosSettings )
12451286
1287+ // move server back to available state (to avoid initial/discovery state loop)
1288+ By ("Ensure that the Server is in available state" )
1289+ Eventually (UpdateStatus (server , func () {
1290+ server .Status .State = metalv1alpha1 .ServerStateAvailable
1291+ })).Should (Succeed ())
1292+
12461293 // should reconcile again from the Applied state when the settings has been changed
12471294 Eventually (Update (biosSettings , func () {
12481295 biosSettings .Spec .SettingsFlow [1 ].Settings = map [string ]string {"PowerProfile" : "OsDbpm" }
@@ -1261,6 +1308,9 @@ var _ = Describe("BIOSSettings Sequence Controller", func() {
12611308
12621309 By ("Deleting the BIOSSettings" )
12631310 Expect (k8sClient .Delete (ctx , biosSettings )).To (Succeed ())
1311+ Eventually (Object (server )).Should (
1312+ HaveField ("Status.State" , Not (Equal (metalv1alpha1 .ServerStateMaintenance ))),
1313+ )
12641314 })
12651315
12661316 It ("should successfully apply sequence of settings when the names and priority changed, before the settings update was issued on server" , func (ctx SpecContext ) {
@@ -1354,6 +1404,9 @@ var _ = Describe("BIOSSettings Sequence Controller", func() {
13541404
13551405 By ("Deleting the BIOSSetting" )
13561406 Expect (k8sClient .Delete (ctx , biosSettings )).To (Succeed ())
1407+ Eventually (Object (server )).Should (
1408+ HaveField ("Status.State" , Not (Equal (metalv1alpha1 .ServerStateMaintenance ))),
1409+ )
13571410 })
13581411})
13591412
0 commit comments