2022-02-08 17:34:57 +00:00
|
|
|
package upgradecluster
|
|
|
|
|
|
|
|
import (
|
|
|
|
"flag"
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
"strings"
|
|
|
|
"testing"
|
|
|
|
|
2022-02-09 16:22:53 +00:00
|
|
|
. "github.com/onsi/ginkgo/v2"
|
2022-02-08 17:34:57 +00:00
|
|
|
. "github.com/onsi/gomega"
|
|
|
|
"github.com/rancher/k3s/tests/e2e"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Valid nodeOS: generic/ubuntu2004, opensuse/Leap-15.3.x86_64, dweomer/microos.amd64
|
|
|
|
var nodeOS = flag.String("nodeOS", "generic/ubuntu2004", "VM operating system")
|
|
|
|
var serverCount = flag.Int("serverCount", 3, "number of server nodes")
|
|
|
|
var agentCount = flag.Int("agentCount", 2, "number of agent nodes")
|
|
|
|
|
2022-03-02 20:42:55 +00:00
|
|
|
// Environment Variables Info:
|
|
|
|
// E2E_RELEASE_VERSION=v1.23.1+k3s2 or nil for latest commit from master
|
2022-02-08 17:34:57 +00:00
|
|
|
|
|
|
|
func Test_E2EUpgradeValidation(t *testing.T) {
|
|
|
|
RegisterFailHandler(Fail)
|
|
|
|
flag.Parse()
|
2022-02-09 16:22:53 +00:00
|
|
|
RunSpecs(t, "Create Cluster Test Suite")
|
2022-02-08 17:34:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
var (
|
|
|
|
kubeConfigFile string
|
2022-03-02 20:42:55 +00:00
|
|
|
serverNodeNames []string
|
|
|
|
agentNodeNames []string
|
2022-02-08 17:34:57 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var _ = Describe("Verify Upgrade", func() {
|
|
|
|
Context("Cluster :", func() {
|
|
|
|
It("Starts up with no issues", func() {
|
|
|
|
var err error
|
2022-03-02 20:42:55 +00:00
|
|
|
serverNodeNames, agentNodeNames, err = e2e.CreateCluster(*nodeOS, *serverCount, *agentCount)
|
|
|
|
Expect(err).NotTo(HaveOccurred())
|
2022-02-08 17:34:57 +00:00
|
|
|
fmt.Println("CLUSTER CONFIG")
|
|
|
|
fmt.Println("OS:", *nodeOS)
|
2022-03-02 20:42:55 +00:00
|
|
|
fmt.Println("Server Nodes:", serverNodeNames)
|
|
|
|
fmt.Println("Agent Nodes:", agentNodeNames)
|
|
|
|
kubeConfigFile, err = e2e.GenKubeConfigFile(serverNodeNames[0])
|
2022-02-08 17:34:57 +00:00
|
|
|
Expect(err).NotTo(HaveOccurred())
|
|
|
|
})
|
|
|
|
|
|
|
|
It("Checks Node and Pod Status", func() {
|
|
|
|
fmt.Printf("\nFetching node status\n")
|
|
|
|
Eventually(func(g Gomega) {
|
|
|
|
nodes, err := e2e.ParseNodes(kubeConfigFile, false)
|
|
|
|
g.Expect(err).NotTo(HaveOccurred())
|
|
|
|
for _, node := range nodes {
|
|
|
|
g.Expect(node.Status).Should(Equal("Ready"))
|
|
|
|
}
|
|
|
|
}, "420s", "5s").Should(Succeed())
|
|
|
|
_, _ = e2e.ParseNodes(kubeConfigFile, true)
|
|
|
|
|
|
|
|
fmt.Printf("\nFetching Pods status\n")
|
|
|
|
Eventually(func(g Gomega) {
|
|
|
|
pods, err := e2e.ParsePods(kubeConfigFile, false)
|
|
|
|
g.Expect(err).NotTo(HaveOccurred())
|
|
|
|
for _, pod := range pods {
|
|
|
|
if strings.Contains(pod.Name, "helm-install") {
|
|
|
|
g.Expect(pod.Status).Should(Equal("Completed"), pod.Name)
|
|
|
|
} else {
|
|
|
|
g.Expect(pod.Status).Should(Equal("Running"), pod.Name)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, "420s", "5s").Should(Succeed())
|
|
|
|
_, _ = e2e.ParsePods(kubeConfigFile, true)
|
|
|
|
})
|
|
|
|
|
|
|
|
It("Verifies ClusterIP Service", func() {
|
|
|
|
_, err := e2e.DeployWorkload("clusterip.yaml", kubeConfigFile, false)
|
|
|
|
|
|
|
|
Expect(err).NotTo(HaveOccurred(), "Cluster IP manifest not deployed")
|
|
|
|
|
2022-02-10 17:27:00 +00:00
|
|
|
cmd := "kubectl get pods -o=name -l k8s-app=nginx-app-clusterip --field-selector=status.phase=Running --kubeconfig=" + kubeConfigFile
|
|
|
|
Eventually(func() (string, error) {
|
|
|
|
return e2e.RunCommand(cmd)
|
|
|
|
}, "240s", "5s").Should(ContainSubstring("test-clusterip"), "failed cmd: "+cmd)
|
2022-02-08 17:34:57 +00:00
|
|
|
|
|
|
|
clusterip, _ := e2e.FetchClusterIP(kubeConfigFile, "nginx-clusterip-svc")
|
2022-03-01 19:28:39 +00:00
|
|
|
cmd = "curl -L --insecure http://" + clusterip + "/name.html"
|
2022-03-02 20:42:55 +00:00
|
|
|
for _, nodeName := range serverNodeNames {
|
2022-02-10 17:27:00 +00:00
|
|
|
Eventually(func() (string, error) {
|
|
|
|
return e2e.RunCmdOnNode(cmd, nodeName)
|
|
|
|
}, "120s", "10s").Should(ContainSubstring("test-clusterip"), "failed cmd: "+cmd)
|
2022-02-08 17:34:57 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
It("Verifies NodePort Service", func() {
|
|
|
|
_, err := e2e.DeployWorkload("nodeport.yaml", kubeConfigFile, false)
|
|
|
|
Expect(err).NotTo(HaveOccurred(), "NodePort manifest not deployed")
|
|
|
|
|
2022-03-02 20:42:55 +00:00
|
|
|
for _, nodeName := range serverNodeNames {
|
2022-02-08 17:34:57 +00:00
|
|
|
node_external_ip, _ := e2e.FetchNodeExternalIP(nodeName)
|
|
|
|
cmd := "kubectl get service nginx-nodeport-svc --kubeconfig=" + kubeConfigFile + " --output jsonpath=\"{.spec.ports[0].nodePort}\""
|
|
|
|
nodeport, err := e2e.RunCommand(cmd)
|
2022-02-10 17:27:00 +00:00
|
|
|
Expect(err).NotTo(HaveOccurred(), "failed cmd: "+cmd)
|
|
|
|
|
|
|
|
cmd = "kubectl get pods -o=name -l k8s-app=nginx-app-nodeport --field-selector=status.phase=Running --kubeconfig=" + kubeConfigFile
|
|
|
|
Eventually(func() (string, error) {
|
|
|
|
return e2e.RunCommand(cmd)
|
|
|
|
}, "240s", "5s").Should(ContainSubstring("test-nodeport"), "nodeport pod was not created")
|
2022-02-08 17:34:57 +00:00
|
|
|
|
|
|
|
cmd = "curl -L --insecure http://" + node_external_ip + ":" + nodeport + "/name.html"
|
|
|
|
fmt.Println(cmd)
|
2022-02-10 17:27:00 +00:00
|
|
|
Eventually(func() (string, error) {
|
|
|
|
return e2e.RunCommand(cmd)
|
|
|
|
}, "240s", "5s").Should(ContainSubstring("test-nodeport"), "failed cmd: "+cmd)
|
2022-02-08 17:34:57 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
It("Verifies LoadBalancer Service", func() {
|
|
|
|
_, err := e2e.DeployWorkload("loadbalancer.yaml", kubeConfigFile, false)
|
|
|
|
Expect(err).NotTo(HaveOccurred(), "Loadbalancer manifest not deployed")
|
2022-03-02 20:42:55 +00:00
|
|
|
for _, nodeName := range serverNodeNames {
|
2022-02-08 17:34:57 +00:00
|
|
|
ip, _ := e2e.FetchNodeExternalIP(nodeName)
|
|
|
|
cmd := "kubectl get service nginx-loadbalancer-svc --kubeconfig=" + kubeConfigFile + " --output jsonpath=\"{.spec.ports[0].port}\""
|
|
|
|
port, err := e2e.RunCommand(cmd)
|
|
|
|
Expect(err).NotTo(HaveOccurred())
|
|
|
|
|
2022-02-10 17:27:00 +00:00
|
|
|
cmd = "kubectl get pods -o=name -l k8s-app=nginx-app-loadbalancer --field-selector=status.phase=Running --kubeconfig=" + kubeConfigFile
|
|
|
|
Eventually(func() (string, error) {
|
|
|
|
return e2e.RunCommand(cmd)
|
|
|
|
}, "240s", "5s").Should(ContainSubstring("test-loadbalancer"))
|
|
|
|
|
|
|
|
cmd = "curl -L --insecure http://" + ip + ":" + port + "/name.html"
|
|
|
|
Eventually(func() (string, error) {
|
|
|
|
return e2e.RunCommand(cmd)
|
|
|
|
}, "240s", "5s").Should(ContainSubstring("test-loadbalancer"), "failed cmd: "+cmd)
|
2022-02-08 17:34:57 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
It("Verifies Ingress", func() {
|
|
|
|
_, err := e2e.DeployWorkload("ingress.yaml", kubeConfigFile, false)
|
|
|
|
Expect(err).NotTo(HaveOccurred(), "Ingress manifest not deployed")
|
|
|
|
|
2022-03-02 20:42:55 +00:00
|
|
|
for _, nodeName := range serverNodeNames {
|
2022-02-08 17:34:57 +00:00
|
|
|
ip, _ := e2e.FetchNodeExternalIP(nodeName)
|
|
|
|
cmd := "curl --header host:foo1.bar.com" + " http://" + ip + "/name.html"
|
2022-02-10 17:27:00 +00:00
|
|
|
Eventually(func() (string, error) {
|
|
|
|
return e2e.RunCommand(cmd)
|
|
|
|
}, "240s", "5s").Should(ContainSubstring("test-ingress"), "failed cmd: "+cmd)
|
2022-02-08 17:34:57 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
It("Verifies Daemonset", func() {
|
|
|
|
_, err := e2e.DeployWorkload("daemonset.yaml", kubeConfigFile, false)
|
|
|
|
Expect(err).NotTo(HaveOccurred(), "Daemonset manifest not deployed")
|
|
|
|
|
|
|
|
nodes, _ := e2e.ParseNodes(kubeConfigFile, false) //nodes :=
|
|
|
|
pods, _ := e2e.ParsePods(kubeConfigFile, false)
|
|
|
|
|
|
|
|
Eventually(func(g Gomega) {
|
|
|
|
count := e2e.CountOfStringInSlice("test-daemonset", pods)
|
|
|
|
fmt.Println("POD COUNT")
|
|
|
|
fmt.Println(count)
|
|
|
|
fmt.Println("NODE COUNT")
|
|
|
|
fmt.Println(len(nodes))
|
|
|
|
g.Expect(len(nodes)).Should((Equal(count)), "Daemonset pod count does not match node count")
|
|
|
|
}, "240s", "10s").Should(Succeed())
|
|
|
|
})
|
|
|
|
|
|
|
|
It("Verifies dns access", func() {
|
|
|
|
_, err := e2e.DeployWorkload("dnsutils.yaml", kubeConfigFile, false)
|
|
|
|
Expect(err).NotTo(HaveOccurred(), "dnsutils manifest not deployed")
|
|
|
|
|
2022-02-10 17:27:00 +00:00
|
|
|
Eventually(func() (string, error) {
|
2022-02-08 17:34:57 +00:00
|
|
|
cmd := "kubectl get pods dnsutils --kubeconfig=" + kubeConfigFile
|
2022-02-10 17:27:00 +00:00
|
|
|
return e2e.RunCommand(cmd)
|
|
|
|
}, "420s", "2s").Should(ContainSubstring("dnsutils"))
|
2022-02-08 17:34:57 +00:00
|
|
|
|
2022-02-10 17:27:00 +00:00
|
|
|
cmd := "kubectl --kubeconfig=" + kubeConfigFile + " exec -i -t dnsutils -- nslookup kubernetes.default"
|
|
|
|
Eventually(func() (string, error) {
|
|
|
|
return e2e.RunCommand(cmd)
|
|
|
|
}, "420s", "2s").Should(ContainSubstring("kubernetes.default.svc.cluster.local"))
|
2022-02-08 17:34:57 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
It("Verifies Local Path Provisioner storage ", func() {
|
|
|
|
_, err := e2e.DeployWorkload("local-path-provisioner.yaml", kubeConfigFile, false)
|
|
|
|
Expect(err).NotTo(HaveOccurred(), "local-path-provisioner manifest not deployed")
|
|
|
|
Eventually(func(g Gomega) {
|
|
|
|
cmd := "kubectl get pvc local-path-pvc --kubeconfig=" + kubeConfigFile
|
|
|
|
res, err := e2e.RunCommand(cmd)
|
|
|
|
g.Expect(err).NotTo(HaveOccurred())
|
|
|
|
fmt.Println(res)
|
|
|
|
g.Expect(res).Should(ContainSubstring("local-path-pvc"))
|
|
|
|
g.Expect(res).Should(ContainSubstring("Bound"))
|
|
|
|
}, "240s", "2s").Should(Succeed())
|
|
|
|
|
|
|
|
Eventually(func(g Gomega) {
|
|
|
|
cmd := "kubectl get pod volume-test --kubeconfig=" + kubeConfigFile
|
|
|
|
res, err := e2e.RunCommand(cmd)
|
|
|
|
g.Expect(err).NotTo(HaveOccurred())
|
|
|
|
fmt.Println(res)
|
|
|
|
|
|
|
|
g.Expect(res).Should(ContainSubstring("volume-test"))
|
|
|
|
g.Expect(res).Should(ContainSubstring("Running"))
|
|
|
|
}, "420s", "2s").Should(Succeed())
|
|
|
|
|
|
|
|
cmd := "kubectl --kubeconfig=" + kubeConfigFile + " exec volume-test -- sh -c 'echo local-path-test > /data/test'"
|
|
|
|
_, err = e2e.RunCommand(cmd)
|
|
|
|
Expect(err).NotTo(HaveOccurred())
|
|
|
|
fmt.Println("Data stored in pvc: local-path-test")
|
|
|
|
|
|
|
|
cmd = "kubectl delete pod volume-test --kubeconfig=" + kubeConfigFile
|
|
|
|
res, err := e2e.RunCommand(cmd)
|
|
|
|
Expect(err).NotTo(HaveOccurred())
|
|
|
|
fmt.Println(res)
|
|
|
|
|
|
|
|
_, err = e2e.DeployWorkload("local-path-provisioner.yaml", kubeConfigFile, false)
|
|
|
|
Expect(err).NotTo(HaveOccurred(), "local-path-provisioner manifest not deployed")
|
|
|
|
|
2022-02-10 17:27:00 +00:00
|
|
|
Eventually(func() (string, error) {
|
2022-02-08 17:34:57 +00:00
|
|
|
cmd := "kubectl get pods -o=name -l app=local-path-provisioner --field-selector=status.phase=Running -n kube-system --kubeconfig=" + kubeConfigFile
|
2022-02-10 17:27:00 +00:00
|
|
|
return e2e.RunCommand(cmd)
|
|
|
|
}, "420s", "2s").Should(ContainSubstring("local-path-provisioner"))
|
2022-02-08 17:34:57 +00:00
|
|
|
|
|
|
|
Eventually(func(g Gomega) {
|
|
|
|
cmd := "kubectl get pod volume-test --kubeconfig=" + kubeConfigFile
|
|
|
|
res, err := e2e.RunCommand(cmd)
|
|
|
|
g.Expect(err).NotTo(HaveOccurred())
|
|
|
|
fmt.Println(res)
|
|
|
|
g.Expect(res).Should(ContainSubstring("volume-test"))
|
|
|
|
g.Expect(res).Should(ContainSubstring("Running"))
|
|
|
|
}, "420s", "2s").Should(Succeed())
|
|
|
|
|
2022-02-10 17:27:00 +00:00
|
|
|
// Check data after re-creation
|
|
|
|
Eventually(func() (string, error) {
|
2022-02-08 17:34:57 +00:00
|
|
|
cmd = "kubectl exec volume-test cat /data/test --kubeconfig=" + kubeConfigFile
|
2022-02-10 17:27:00 +00:00
|
|
|
return e2e.RunCommand(cmd)
|
|
|
|
}, "180s", "2s").Should(ContainSubstring("local-path-test"))
|
2022-02-08 17:34:57 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
It("Upgrades with no issues", func() {
|
|
|
|
var err error
|
2022-03-02 20:42:55 +00:00
|
|
|
err = e2e.UpgradeCluster(serverNodeNames, agentNodeNames)
|
2022-02-08 17:34:57 +00:00
|
|
|
fmt.Println(err)
|
|
|
|
Expect(err).NotTo(HaveOccurred())
|
|
|
|
fmt.Println("CLUSTER UPGRADED")
|
2022-03-02 20:42:55 +00:00
|
|
|
kubeConfigFile, err = e2e.GenKubeConfigFile(serverNodeNames[0])
|
2022-02-08 17:34:57 +00:00
|
|
|
Expect(err).NotTo(HaveOccurred())
|
|
|
|
})
|
|
|
|
|
|
|
|
It("After upgrade Checks Node and Pod Status", func() {
|
|
|
|
fmt.Printf("\nFetching node status\n")
|
|
|
|
Eventually(func(g Gomega) {
|
|
|
|
nodes, err := e2e.ParseNodes(kubeConfigFile, false)
|
|
|
|
g.Expect(err).NotTo(HaveOccurred())
|
|
|
|
for _, node := range nodes {
|
|
|
|
g.Expect(node.Status).Should(Equal("Ready"))
|
|
|
|
}
|
|
|
|
}, "420s", "5s").Should(Succeed())
|
2022-02-10 17:27:00 +00:00
|
|
|
e2e.ParseNodes(kubeConfigFile, true)
|
2022-02-08 17:34:57 +00:00
|
|
|
|
|
|
|
fmt.Printf("\nFetching Pods status\n")
|
|
|
|
Eventually(func(g Gomega) {
|
|
|
|
pods, err := e2e.ParsePods(kubeConfigFile, false)
|
|
|
|
g.Expect(err).NotTo(HaveOccurred())
|
|
|
|
for _, pod := range pods {
|
|
|
|
if strings.Contains(pod.Name, "helm-install") {
|
|
|
|
g.Expect(pod.Status).Should(Equal("Completed"))
|
|
|
|
} else {
|
|
|
|
g.Expect(pod.Status).Should(Equal("Running"))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, "420s", "5s").Should(Succeed())
|
2022-02-10 17:27:00 +00:00
|
|
|
e2e.ParsePods(kubeConfigFile, true)
|
2022-02-08 17:34:57 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
It("After upgrade verifies ClusterIP Service", func() {
|
2022-02-10 17:27:00 +00:00
|
|
|
Eventually(func() (string, error) {
|
2022-02-08 17:34:57 +00:00
|
|
|
cmd := "kubectl get pods -o=name -l k8s-app=nginx-app-clusterip --field-selector=status.phase=Running --kubeconfig=" + kubeConfigFile
|
2022-02-10 17:27:00 +00:00
|
|
|
return e2e.RunCommand(cmd)
|
|
|
|
}, "420s", "5s").Should(ContainSubstring("test-clusterip"))
|
2022-02-08 17:34:57 +00:00
|
|
|
|
|
|
|
clusterip, _ := e2e.FetchClusterIP(kubeConfigFile, "nginx-clusterip-svc")
|
2022-03-01 19:28:39 +00:00
|
|
|
cmd := "curl -L --insecure http://" + clusterip + "/name.html"
|
2022-02-08 17:34:57 +00:00
|
|
|
fmt.Println(cmd)
|
2022-03-02 20:42:55 +00:00
|
|
|
for _, nodeName := range serverNodeNames {
|
2022-02-10 17:27:00 +00:00
|
|
|
Eventually(func() (string, error) {
|
|
|
|
return e2e.RunCmdOnNode(cmd, nodeName)
|
|
|
|
}, "120s", "10s").Should(ContainSubstring("test-clusterip"), "failed cmd: "+cmd)
|
2022-02-08 17:34:57 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
It("After upgrade verifies NodePort Service", func() {
|
|
|
|
|
2022-03-02 20:42:55 +00:00
|
|
|
for _, nodeName := range serverNodeNames {
|
2022-02-08 17:34:57 +00:00
|
|
|
node_external_ip, _ := e2e.FetchNodeExternalIP(nodeName)
|
|
|
|
cmd := "kubectl get service nginx-nodeport-svc --kubeconfig=" + kubeConfigFile + " --output jsonpath=\"{.spec.ports[0].nodePort}\""
|
|
|
|
nodeport, err := e2e.RunCommand(cmd)
|
|
|
|
Expect(err).NotTo(HaveOccurred())
|
|
|
|
|
2022-02-10 17:27:00 +00:00
|
|
|
Eventually(func() (string, error) {
|
2022-02-08 17:34:57 +00:00
|
|
|
cmd := "kubectl get pods -o=name -l k8s-app=nginx-app-nodeport --field-selector=status.phase=Running --kubeconfig=" + kubeConfigFile
|
2022-02-10 17:27:00 +00:00
|
|
|
return e2e.RunCommand(cmd)
|
|
|
|
}, "240s", "5s").Should(ContainSubstring("test-nodeport"), "nodeport pod was not created")
|
2022-02-08 17:34:57 +00:00
|
|
|
|
|
|
|
cmd = "curl -L --insecure http://" + node_external_ip + ":" + nodeport + "/name.html"
|
|
|
|
fmt.Println(cmd)
|
2022-02-10 17:27:00 +00:00
|
|
|
Eventually(func() (string, error) {
|
|
|
|
return e2e.RunCommand(cmd)
|
|
|
|
}, "240s", "5s").Should(ContainSubstring("test-nodeport"))
|
2022-02-08 17:34:57 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
It("After upgrade verifies LoadBalancer Service", func() {
|
2022-03-02 20:42:55 +00:00
|
|
|
for _, nodeName := range serverNodeNames {
|
2022-02-08 17:34:57 +00:00
|
|
|
ip, _ := e2e.FetchNodeExternalIP(nodeName)
|
|
|
|
cmd := "kubectl get service nginx-loadbalancer-svc --kubeconfig=" + kubeConfigFile + " --output jsonpath=\"{.spec.ports[0].port}\""
|
|
|
|
port, err := e2e.RunCommand(cmd)
|
|
|
|
Expect(err).NotTo(HaveOccurred())
|
2022-02-10 17:27:00 +00:00
|
|
|
Eventually(func() (string, error) {
|
|
|
|
cmd := "curl -L --insecure http://" + ip + ":" + port + "/name.html"
|
|
|
|
return e2e.RunCommand(cmd)
|
|
|
|
}, "240s", "5s").Should(ContainSubstring("test-loadbalancer"))
|
|
|
|
|
|
|
|
Eventually(func() (string, error) {
|
2022-02-08 17:34:57 +00:00
|
|
|
cmd := "kubectl get pods -o=name -l k8s-app=nginx-app-loadbalancer --field-selector=status.phase=Running --kubeconfig=" + kubeConfigFile
|
2022-02-10 17:27:00 +00:00
|
|
|
return e2e.RunCommand(cmd)
|
|
|
|
}, "240s", "5s").Should(ContainSubstring("test-loadbalancer"))
|
2022-02-08 17:34:57 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
It("After upgrade verifies Ingress", func() {
|
2022-03-02 20:42:55 +00:00
|
|
|
for _, nodeName := range serverNodeNames {
|
2022-02-08 17:34:57 +00:00
|
|
|
ip, _ := e2e.FetchNodeExternalIP(nodeName)
|
|
|
|
cmd := "curl --header host:foo1.bar.com" + " http://" + ip + "/name.html"
|
|
|
|
fmt.Println(cmd)
|
|
|
|
|
2022-02-10 17:27:00 +00:00
|
|
|
Eventually(func() (string, error) {
|
|
|
|
return e2e.RunCommand(cmd)
|
|
|
|
}, "420s", "5s").Should(ContainSubstring("test-ingress"))
|
2022-02-08 17:34:57 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
It("After upgrade verifies Daemonset", func() {
|
|
|
|
nodes, _ := e2e.ParseNodes(kubeConfigFile, false) //nodes :=
|
|
|
|
pods, _ := e2e.ParsePods(kubeConfigFile, false)
|
|
|
|
|
|
|
|
Eventually(func(g Gomega) {
|
|
|
|
count := e2e.CountOfStringInSlice("test-daemonset", pods)
|
|
|
|
fmt.Println("POD COUNT")
|
|
|
|
fmt.Println(count)
|
|
|
|
fmt.Println("NODE COUNT")
|
|
|
|
fmt.Println(len(nodes))
|
|
|
|
g.Expect(len(nodes)).Should(Equal(count), "Daemonset pod count does not match node count")
|
|
|
|
}, "420s", "1s").Should(Succeed())
|
|
|
|
})
|
|
|
|
It("After upgrade verifies dns access", func() {
|
2022-02-10 17:27:00 +00:00
|
|
|
Eventually(func() (string, error) {
|
2022-02-08 17:34:57 +00:00
|
|
|
cmd := "kubectl --kubeconfig=" + kubeConfigFile + " exec -i -t dnsutils -- nslookup kubernetes.default"
|
2022-02-10 17:27:00 +00:00
|
|
|
return e2e.RunCommand(cmd)
|
|
|
|
}, "180s", "2s").Should((ContainSubstring("kubernetes.default.svc.cluster.local")))
|
2022-02-08 17:34:57 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
It("After upgrade verify Local Path Provisioner storage ", func() {
|
2022-02-10 17:27:00 +00:00
|
|
|
Eventually(func() (string, error) {
|
2022-02-08 17:34:57 +00:00
|
|
|
cmd := "kubectl exec volume-test cat /data/test --kubeconfig=" + kubeConfigFile
|
2022-02-10 17:27:00 +00:00
|
|
|
return e2e.RunCommand(cmd)
|
|
|
|
}, "180s", "2s").Should(ContainSubstring("local-path-test"))
|
2022-02-08 17:34:57 +00:00
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
var failed = false
|
|
|
|
var _ = AfterEach(func() {
|
|
|
|
failed = failed || CurrentGinkgoTestDescription().Failed
|
|
|
|
})
|
|
|
|
|
|
|
|
var _ = AfterSuite(func() {
|
|
|
|
if failed {
|
|
|
|
fmt.Println("FAILED!")
|
|
|
|
} else {
|
|
|
|
Expect(e2e.DestroyCluster()).To(Succeed())
|
|
|
|
Expect(os.Remove(kubeConfigFile)).To(Succeed())
|
|
|
|
}
|
|
|
|
})
|