Use libvmi builder pattern in tests/instancetype_test.go
Use less resources in the test to be more resources efficiency
@@ -61,7 +61,7 @@ var _ = Describe("[crit:medium][vendor:cnv-qe@redhat.com][level:component][sig-c
Context("VM with invalid InstancetypeMatcher", func() {
It("[test_id:TODO] should fail to create VM with non-existing cluster instancetype", func() {
- vmi := tests.NewRandomVMI()
+ vmi := libvmi.New()
vm := tests.NewRandomVirtualMachine(vmi, false)
vm.Spec.Instancetype = &v1.InstancetypeMatcher{
Name: "non-existing-cluster-instancetype",
@@ -80,7 +80,7 @@ var _ = Describe("[crit:medium][vendor:cnv-qe@redhat.com][level:component][sig-c
})
It("[test_id:TODO] should fail to create VM with non-existing namespaced instancetype", func() {
- vmi := tests.NewRandomVMI()
+ vmi := libvmi.New()
vm := tests.NewRandomVirtualMachine(vmi, false)
vm.Spec.Instancetype = &v1.InstancetypeMatcher{
Name: "non-existing-instancetype",
@@ -102,7 +102,7 @@ var _ = Describe("[crit:medium][vendor:cnv-qe@redhat.com][level:component][sig-c
Context("VM with invalid PreferenceMatcher", func() {
It("[test_id:TODO] should fail to create VM with non-existing cluster preference", func() {
- vmi := tests.NewRandomVMI()
+ vmi := libvmi.New()
vm := tests.NewRandomVirtualMachine(vmi, false)
vm.Spec.Preference = &v1.PreferenceMatcher{
Name: "non-existing-cluster-preference",
@@ -121,7 +121,7 @@ var _ = Describe("[crit:medium][vendor:cnv-qe@redhat.com][level:component][sig-c
})
It("[test_id:TODO] should fail to create VM with non-existing namespaced preference", func() {
- vmi := tests.NewRandomVMI()
+ vmi := libvmi.New()
vm := tests.NewRandomVirtualMachine(vmi, false)
vm.Spec.Preference = &v1.PreferenceMatcher{
Name: "non-existing-preference",
@@ -270,7 +270,7 @@ var _ = Describe("[crit:medium][vendor:cnv-qe@redhat.com][level:component][sig-c
})
It("[test_id:TODO] should fail if instancetype and VM define CPU", func() {
- vmi := tests.NewRandomVMI()
+ vmi := libvmi.New()
instancetype := newVirtualMachineInstancetype(vmi)
instancetype, err := virtClient.VirtualMachineInstancetype(util.NamespaceTestDefault).
@@ -418,7 +418,7 @@ var _ = Describe("[crit:medium][vendor:cnv-qe@redhat.com][level:component][sig-c
preferenceRevision *appsv1.ControllerRevision
)
- vmi := tests.NewRandomVMI()
+ vmi := libvmi.New()
By("Creating a VirtualMachineInstancetype")
instancetype := newVirtualMachineInstancetype(vmi)
@@ -518,8 +518,7 @@ var _ = Describe("[crit:medium][vendor:cnv-qe@redhat.com][level:component][sig-c
Expect(vmi.Spec.Domain.CPU.Sockets).To(Equal(originalInstancetypeCPUGuest))
By("Creating a second VirtualMachine using the now updated VirtualMachineInstancetype and original VirtualMachinePreference")
- newVMI := tests.NewRandomVMI()
- removeResourcesAndPreferencesFromVMI(newVMI)
+ newVMI := libvmi.New()
newVM := tests.NewRandomVirtualMachine(newVMI, false)
newVM.Spec.Instancetype = &v1.InstancetypeMatcher{
Name: instancetype.Name,
