Fix the CPU set migration test case.
The spec passed to `migratableDomXML()` should be the current domain
spec. If unmarshall the domXML to domain, the `domain.Spec` is actually
empty and the 2 new assertions added in this commit will fail.
@@ -2347,9 +2347,9 @@ var _ = Describe("migratableDomXML", func() {
</domain>`
vmi := newVMI("testns", "kubevirt")
mockDomain.EXPECT().GetXMLDesc(libvirt.DOMAIN_XML_MIGRATABLE).MaxTimes(1).Return(domXML, nil)
- domain := &api.Domain{}
- Expect(xml.Unmarshal([]byte(domXML), domain)).To(Succeed())
- newXML, err := migratableDomXML(mockDomain, vmi, &domain.Spec)
+ domSpec := &api.DomainSpec{}
+ Expect(xml.Unmarshal([]byte(domXML), domSpec)).To(Succeed())
+ newXML, err := migratableDomXML(mockDomain, vmi, domSpec)
Expect(err).ToNot(HaveOccurred())
Expect(newXML).To(Equal(expectedXML))
})
@@ -2425,9 +2425,11 @@ var _ = Describe("migratableDomXML", func() {
By("generated the domain XML for a migration to that target")
mockDomain.EXPECT().GetXMLDesc(libvirt.DOMAIN_XML_MIGRATABLE).MaxTimes(1).Return(domXML, nil)
- domain := &api.Domain{}
- Expect(xml.Unmarshal([]byte(domXML), domain)).To(Succeed())
- newXML, err := migratableDomXML(mockDomain, vmi, &domain.Spec)
+ domSpec := &api.DomainSpec{}
+ Expect(xml.Unmarshal([]byte(domXML), domSpec)).To(Succeed())
+ Expect(domSpec.VCPU).NotTo(BeNil())
+ Expect(domSpec.CPUTune).NotTo(BeNil())
+ newXML, err := migratableDomXML(mockDomain, vmi, domSpec)
Expect(err).ToNot(HaveOccurred(), "failed to generate target domain XML")
By("ensuring the generated XML is accurate")
