Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

Commit

Permalink
fix(e2e): upgrade test fixes
Browse files Browse the repository at this point in the history
These changes fix current issues with the upgrade e2e test:

- Remove a check that the `kubectl` executable is present before running
  the upgrade e2e test. Because CRDs are now upgraded with hooks in the
  Helm chart instead of invoking `kubectl` in the test, this is no
  longer necessary.

- Remove the step to reinstall the SMI policy resources, since that is
  no longer necessary with the new CRD management.

- Restart the injected Pods to handle incompatible certificate common
  name formats between the old and new OSM installations.

Signed-off-by: Jon Huhn <[email protected]>
  • Loading branch information
nojnhuh committed Jul 22, 2021
1 parent b370fa2 commit 1cd4a17
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions tests/e2e/e2e_upgrade_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package e2e

import (
"os/exec"
"context"
"path/filepath"
"time"

Expand All @@ -10,6 +10,8 @@ import (
"helm.sh/helm/v3/pkg/action"
"helm.sh/helm/v3/pkg/chart/loader"
"helm.sh/helm/v3/pkg/cli"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

. "github.com/openservicemesh/osm/tests/framework"
)
Expand All @@ -27,10 +29,6 @@ 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()
Expand Down Expand Up @@ -101,7 +99,7 @@ var _ = OSMDescribe("Upgrade from latest",
Expect(Td.AddNsToMesh(true, ns)).To(Succeed())

// Get simple pod definitions for the HTTP server
svcAccDef, podDef, svcDef := Td.SimplePodApp(
svcAccDef, dstPodDef, svcDef := Td.SimplePodApp(
SimplePodAppDef{
Name: "server",
Namespace: ns,
Expand All @@ -111,13 +109,13 @@ var _ = OSMDescribe("Upgrade from latest",

_, err = Td.CreateServiceAccount(ns, &svcAccDef)
Expect(err).NotTo(HaveOccurred())
dstPod, err := Td.CreatePod(ns, podDef)
dstPod, err := Td.CreatePod(ns, dstPodDef)
Expect(err).NotTo(HaveOccurred())
_, err = Td.CreateService(ns, svcDef)
Expect(err).NotTo(HaveOccurred())

// Get simple Pod definitions for the client
svcAccDef, podDef, svcDef = Td.SimplePodApp(SimplePodAppDef{
svcAccDef, srcPodDef, svcDef := Td.SimplePodApp(SimplePodAppDef{
Name: "client",
Namespace: ns,
Command: []string{"/bin/bash", "-c", "--"},
Expand All @@ -128,7 +126,7 @@ var _ = OSMDescribe("Upgrade from latest",

_, err = Td.CreateServiceAccount(ns, &svcAccDef)
Expect(err).NotTo(HaveOccurred())
srcPod, err := Td.CreatePod(ns, podDef)
srcPod, err := Td.CreatePod(ns, srcPodDef)
Expect(err).NotTo(HaveOccurred())
_, err = Td.CreateService(ns, svcDef)
Expect(err).NotTo(HaveOccurred())
Expand Down Expand Up @@ -215,11 +213,14 @@ var _ = OSMDescribe("Upgrade from latest",
}
Expect(err).NotTo(HaveOccurred())

// Re-deploy policies
_, err = Td.CreateHTTPRouteGroup(ns, httpRG)
Expect(err).NotTo(HaveOccurred())
_, err = Td.CreateTrafficTarget(ns, trafficTarget)
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{})
Expect(err).NotTo(HaveOccurred())
_, err = Td.CreatePod(ns, pod)
Expect(err).NotTo(HaveOccurred())
}
Expect(Td.WaitForPodsRunningReady(ns, 90*time.Second, 2, nil)).To(Succeed())

checkClientToServerOK()
checkProxiesConnected()
Expand Down

0 comments on commit 1cd4a17

Please sign in to comment.