Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 29 additions & 2 deletions test/e2e/vsphere/machines.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
. "github.com/onsi/gomega"
"github.com/openshift/api/machine/v1beta1"
machinesetclient "github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1beta1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/dynamic"
"k8s.io/client-go/kubernetes"
Expand Down Expand Up @@ -106,8 +107,21 @@ var _ = Describe("[sig-cluster-lifecycle][OCPFeatureGate:VSphereMultiDisk][platf

// Remove machine
By("delete the machine")
err = mc.Machines(util.MachineAPINamespace).Delete(ctx, machine.Name, metav1.DeleteOptions{})
policy := metav1.DeletePropagationForeground
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assuming this is implemented by the controller, let's see

err = mc.Machines(util.MachineAPINamespace).Delete(ctx, machine.Name, metav1.DeleteOptions{PropagationPolicy: &policy})
Expect(err).NotTo(HaveOccurred())

// Verify / wait for machine is removed
By("verifying machine is destroyed")
Eventually(func() error {
if _, err := mc.Machines(util.MachineAPINamespace).Get(ctx, machine.Name, metav1.GetOptions{}); err != nil {
if apierrors.IsNotFound(err) {
return nil
}
return err
}
return nil
}, machineReadyTimeout).Should(Succeed())
})

DescribeTable("create machinesets", func(msName string, dataDisks []v1beta1.VSphereDisk) {
Expand Down Expand Up @@ -163,8 +177,21 @@ var _ = Describe("[sig-cluster-lifecycle][OCPFeatureGate:VSphereMultiDisk][platf

// Delete machineset
By("deleting the machineset")
err = mc.MachineSets(util.MachineAPINamespace).Delete(ctx, ddMachineSet.Name, metav1.DeleteOptions{})
policy := metav1.DeletePropagationForeground
err = mc.MachineSets(util.MachineAPINamespace).Delete(ctx, ddMachineSet.Name, metav1.DeleteOptions{PropagationPolicy: &policy})
Expect(err).NotTo(HaveOccurred())

// Verify / wait for machineset is removed
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assuming the policy is propagated to machines and is implemented, let's see

By("verifying machine is destroyed")
Eventually(func() error {
if _, err := mc.MachineSets(util.MachineAPINamespace).Get(ctx, ddMachineSet.Name, metav1.GetOptions{}); err != nil {
if apierrors.IsNotFound(err) {
return nil
}
return err
}
return nil
}, machineReadyTimeout).Should(Succeed())
},
Entry("with thin data disk [apigroup:machine.openshift.io][Serial][Suite:openshift/conformance/serial]", "ms-thin-test", []v1beta1.VSphereDisk{
{
Expand Down