test: Allow disruptive tests on any platform with machine APIs
We should use a dynamic mechanism rather than a static one.
@@ -47,20 +47,6 @@ var _ = g.Describe("[sig-etcd][Feature:DisasterRecovery][Disruptive]", func() {
oc := exutil.NewCLIWithoutNamespace("disaster-recovery")
g.It("[Feature:EtcdRecovery] Cluster should restore itself after quorum loss", func() {
- e2eskipper.SkipUnlessProviderIs("aws")
-
- disruption.Run("Quorum Loss and Restore", "quorum_restore",
- disruption.TestData{},
- []upgrades.Test{
- &upgrades.ServiceUpgradeTest{},
- &upgrades.SecretUpgradeTest{},
- &apps.ReplicaSetUpgradeTest{},
- &apps.StatefulSetUpgradeTest{},
- &apps.DeploymentUpgradeTest{},
- &apps.DaemonSetUpgradeTest{},
- },
- func() {
-
config, err := framework.LoadConfig()
o.Expect(err).NotTo(o.HaveOccurred())
dynamicClient := dynamic.NewForConfigOrDie(config)
@@ -80,6 +66,29 @@ var _ = g.Describe("[sig-etcd][Feature:DisasterRecovery][Disruptive]", func() {
Resource: "clusteroperators",
})
+ // test for machines as a proxy for "can we recover a master"
+ machines, err := dynamicClient.Resource(schema.GroupVersionResource{
+ Group: "machine.openshift.io",
+ Version: "v1beta1",
+ Resource: "machines",
+ }).List(context.Background(), metav1.ListOptions{})
+ o.Expect(err).NotTo(o.HaveOccurred())
+ if len(machines.Items) == 0 {
+ e2eskipper.Skipf("machine API is not enabled and automatic recovery test is not possible")
+ }
+
+ disruption.Run("Quorum Loss and Restore", "quorum_restore",
+ disruption.TestData{},
+ []upgrades.Test{
+ &upgrades.ServiceUpgradeTest{},
+ &upgrades.SecretUpgradeTest{},
+ &apps.ReplicaSetUpgradeTest{},
+ &apps.StatefulSetUpgradeTest{},
+ &apps.DeploymentUpgradeTest{},
+ &apps.DaemonSetUpgradeTest{},
+ },
+ func() {
+
framework.Logf("Verify SSH is available before restart")
masters := masterNodes(oc)
o.Expect(len(masters)).To(o.BeNumerically(">=", 1))
