feat(crdUpgrades): Update upgrade e2e to verify all CRD's are present on the cluster
Updated the upgrade e2e to validate that all the CRD's required by OSM are present on the cluster post and upgrade.
@@ -2,6 +2,7 @@ package e2e
import (
"context"
+ "os/exec"
"path/filepath"
"time"
@@ -29,6 +30,10 @@ var _ = OSMDescribe("Upgrade from latest",
Skip("test requires fresh OSM install")
}
+ if _, err := exec.LookPath("kubectl"); err != nil {
+ Td.T.Fatal("\"kubectl\" command required and not found on PATH")
+ }
+
helmCfg := &action.Configuration{}
Expect(helmCfg.Init(Td.Env.RESTClientGetter(), Td.OsmNamespace, "secret", Td.T.Logf)).To(Succeed())
helmEnv := cli.New()
@@ -213,6 +218,16 @@ var _ = OSMDescribe("Upgrade from latest",
}
Expect(err).NotTo(HaveOccurred())
+ // Verify that all the CRD's required by OSM are present in the cluster post an upgrade
+ // TODO: Find a decent way to do this without relying on the kubectl binary
+ // TODO: In the future when we bump the version on a CRD, we need to update this check to ensure that the version is the latest required version
+ stdout, stderr, err = Td.RunLocal("kubectl", "get", "-f", filepath.FromSlash("../../charts/osm/crds"))
+ Td.T.Log(stdout.String())
+ if err != nil {
+ Td.T.Log("stderr:\n" + stderr.String())
+ }
+ Expect(err).NotTo(HaveOccurred())
+
By("Recreating client and server pods")
for _, pod := range []corev1.Pod{srcPodDef, dstPodDef} {
err = Td.Client.CoreV1().Pods(ns).Delete(context.Background(), pod.Name, metav1.DeleteOptions{})
