@@ -124,6 +124,9 @@ var _ = Describe("VirtualMachineOperationRestore", Serial, ginkgoutil.CommonE2ET
124
124
})
125
125
126
126
It ("Reboot VM" , func () {
127
+ running , _ := conditions .GetCondition (vmcondition .TypeRunning , helper .VM .Status .Conditions )
128
+ helper .VMRunningObservedGenerationBeforeReboot = running .ObservedGeneration
129
+
127
130
Eventually (func (g Gomega ) {
128
131
res := d8Virtualization .SSHCommand (helper .VM .Name , "sudo reboot" , d8.SSHOptions {
129
132
Namespace : helper .VM .Namespace ,
@@ -135,14 +138,13 @@ var _ = Describe("VirtualMachineOperationRestore", Serial, ginkgoutil.CommonE2ET
135
138
136
139
Eventually (func (g Gomega ) {
137
140
helper .UpdateState ()
138
- g .Expect (helper .VM .Status .Phase ).Should (Equal (v1alpha2 .MachineStopped ))
139
- }, 60 * time .Second , time .Second ).Should (Succeed ())
140
141
141
- Eventually (func (g Gomega ) {
142
- helper .UpdateState ()
142
+ running , _ := conditions .GetCondition (vmcondition .TypeRunning , helper .VM .Status .Conditions )
143
+ g .Expect (running .ObservedGeneration ).Should (BeNumerically (">" , helper .VMRunningObservedGenerationBeforeReboot ))
144
+
143
145
agentReady , _ := conditions .GetCondition (vmcondition .TypeAgentReady , helper .VM .Status .Conditions )
144
146
g .Expect (agentReady .Status ).Should (Equal (metav1 .ConditionTrue ))
145
- }, 60 * time .Second , time .Second ).Should (Succeed ())
147
+ }, 120 * time .Second , time .Second ).Should (Succeed ())
146
148
})
147
149
148
150
It ("VM spec should be changed" , func () {
@@ -228,15 +230,17 @@ var _ = Describe("VirtualMachineOperationRestore", Serial, ginkgoutil.CommonE2ET
228
230
startVMOP := resources .NewStartVMOP ("start" , helper .FrameworkEntity .Namespace ().Name , helper .VM .Name )
229
231
err := helper .FrameworkEntity .Clients .GenericClient ().Create (context .Background (), startVMOP )
230
232
Expect (err ).ShouldNot (HaveOccurred ())
231
-
232
- Eventually (func (g Gomega ) {
233
- helper .UpdateState ()
234
- agentReady , _ := conditions .GetCondition (vmcondition .TypeAgentReady , helper .VM .Status .Conditions )
235
- g .Expect (agentReady .Status ).Should (Equal (metav1 .ConditionTrue ))
236
- }, 60 * time .Second , time .Second ).Should (Succeed ())
237
233
}
238
234
})
239
235
236
+ It ("Virtual Machine agent should be ready" , func () {
237
+ Eventually (func (g Gomega ) {
238
+ helper .UpdateState ()
239
+ agentReady , _ := conditions .GetCondition (vmcondition .TypeAgentReady , helper .VM .Status .Conditions )
240
+ g .Expect (agentReady .Status ).Should (Equal (metav1 .ConditionTrue ))
241
+ }, 60 * time .Second , time .Second ).Should (Succeed ())
242
+ })
243
+
240
244
It ("File should have generated value" , func () {
241
245
Eventually (func (g Gomega ) {
242
246
res := d8Virtualization .SSHCommand (helper .VM .Name , helper .MountAndGetDiskFileContentShell (), d8.SSHOptions {
@@ -280,6 +284,9 @@ var _ = Describe("VirtualMachineOperationRestore", Serial, ginkgoutil.CommonE2ET
280
284
})
281
285
282
286
It ("Reboot VM" , func () {
287
+ running , _ := conditions .GetCondition (vmcondition .TypeRunning , helper .VM .Status .Conditions )
288
+ helper .VMRunningObservedGenerationBeforeReboot = running .ObservedGeneration
289
+
283
290
Eventually (func (g Gomega ) {
284
291
res := d8Virtualization .SSHCommand (helper .VM .Name , "sudo reboot" , d8.SSHOptions {
285
292
Namespace : helper .VM .Namespace ,
@@ -291,11 +298,10 @@ var _ = Describe("VirtualMachineOperationRestore", Serial, ginkgoutil.CommonE2ET
291
298
292
299
Eventually (func (g Gomega ) {
293
300
helper .UpdateState ()
294
- g .Expect (helper .VM .Status .Phase ).Should (Equal (v1alpha2 .MachineStopped ))
295
- }, 60 * time .Second , time .Second ).Should (Succeed ())
296
301
297
- Eventually (func (g Gomega ) {
298
- helper .UpdateState ()
302
+ running , _ := conditions .GetCondition (vmcondition .TypeRunning , helper .VM .Status .Conditions )
303
+ g .Expect (running .ObservedGeneration ).Should (BeNumerically (">" , helper .VMRunningObservedGenerationBeforeReboot ))
304
+
299
305
agentReady , _ := conditions .GetCondition (vmcondition .TypeAgentReady , helper .VM .Status .Conditions )
300
306
g .Expect (agentReady .Status ).Should (Equal (metav1 .ConditionTrue ))
301
307
}, 120 * time .Second , time .Second ).Should (Succeed ())
0 commit comments