Add functional test to verify unsupported agent condition is stable
@@ -608,6 +608,56 @@ var _ = Describe("VirtualMachineInstance", func() {
controller.Execute()
})
+ It("should maintain unsupported user agent condition when it's already set", func() {
+ vmi := v1.NewMinimalVMI("testvmi")
+ vmi.UID = vmiTestUUID
+ vmi.ObjectMeta.ResourceVersion = "1"
+ vmi.Status.Phase = v1.Running
+ vmi = addActivePods(vmi, podTestUUID, host)
+ vmi.Status.Conditions = []v1.VirtualMachineInstanceCondition{
+ {
+ Type: v1.VirtualMachineInstanceIsMigratable,
+ Status: k8sv1.ConditionTrue,
+ },
+ {
+ Type: v1.VirtualMachineInstanceAgentConnected,
+ LastProbeTime: metav1.Now(),
+ Status: k8sv1.ConditionTrue,
+ },
+ {
+ Type: v1.VirtualMachineInstanceUnsupportedAgent,
+ LastProbeTime: metav1.Now(),
+ Status: k8sv1.ConditionTrue,
+ },
+ }
+
+ mockWatchdog.CreateFile(vmi)
+
+ domain := api.NewMinimalDomainWithUUID("testvmi", vmiTestUUID)
+ domain.Status.Status = api.Running
+ domain.Spec.Devices.Channels = []api.Channel{
+ {
+ Type: "unix",
+ Target: &api.ChannelTarget{
+ Name: "org.qemu.guest_agent.0",
+ State: "connected",
+ },
+ },
+ }
+
+ vmiFeeder.Add(vmi)
+ domainFeeder.Add(domain)
+
+ client.EXPECT().SyncVirtualMachine(vmi, gomock.Any()).Do(func(vmi *v1.VirtualMachineInstance, options *cmdv1.VirtualMachineOptions) {
+ Expect(options.VirtualMachineSMBios.Family).To(Equal(virtconfig.SmbiosConfigDefaultFamily))
+ Expect(options.VirtualMachineSMBios.Product).To(Equal(virtconfig.SmbiosConfigDefaultProduct))
+ Expect(options.VirtualMachineSMBios.Manufacturer).To(Equal(virtconfig.SmbiosConfigDefaultManufacturer))
+ })
+ client.EXPECT().GetGuestInfo().Return(&v1.VirtualMachineInstanceGuestAgentInfo{}, nil)
+
+ controller.Execute()
+ })
+
It("should remove guest agent condition when there is no channel connected", func() {
vmi := v1.NewMinimalVMI("testvmi")
vmi.UID = vmiTestUUID
