diff --git a/Makefile b/Makefile index 3a84b5937ab6..6f3c0362e976 100644 --- a/Makefile +++ b/Makefile @@ -292,8 +292,13 @@ kind-install-ic: zone=az1 ic_db_host=$$ic_db_host gateway_node_name=kube-ovn1-control-plane j2 yamls/ovn-ic.yaml.j2 -o ovn-ic-1.yaml kubectl config use-context kind-kube-ovn kubectl apply -f ovn-ic-0.yaml + sleep 6 + kubectl -n kube-system get pods | grep ovs-ovn | awk "{print \$1}" | xargs kubectl -n kube-system delete pod kubectl config use-context kind-kube-ovn1 kubectl apply -f ovn-ic-1.yaml + sleep 6 + kubectl -n kube-system get pods | grep ovs-ovn | awk "{print \$1}" | xargs kubectl -n kube-system delete pod + .PHONY: kind-install-cilium kind-install-cilium: kind-load-image kind-untaint-control-plane diff --git a/test/e2e-ovnic/e2e_suite_test.go b/test/e2e-ovnic/e2e_suite_test.go index ab193b7d233f..8404631ad617 100644 --- a/test/e2e-ovnic/e2e_suite_test.go +++ b/test/e2e-ovnic/e2e_suite_test.go @@ -3,6 +3,7 @@ package e2e_ovnic_test import ( "context" "fmt" + "net" "os" "os/exec" "strings" @@ -49,6 +50,13 @@ var _ = SynchronizedAfterSuite(func() {}, func() { checkLSP("ts-az1", pods.Items[0], f) checkLSP("ts-az0", pods.Items[0], f) + output, err = exec.Command("kubectl", "-n", "kube-system", "-l", "app=kube-ovn-pinger", "get", "pod", "-o=jsonpath={.items[0].status.podIP}").CombinedOutput() + Expect(err).NotTo(HaveOccurred()) + if net.ParseIP(string(output)) == nil { + Fail(fmt.Sprintf("pinger ip %s not right", output)) + } + ip0 := string(output) + // To avoid the situation that the wrong kube-config context is loaded in framework, and then the test cloud always // pass the test. a replacement kube-client solution is introduced to force the correct context pod-list to be read. // Then if framework read the wrong context, it will get wrong pod which from another cluster. @@ -76,6 +84,14 @@ var _ = SynchronizedAfterSuite(func() {}, func() { checkLSP("ts-az1", pods1.Items[0], f) checkLSP("ts-az0", pods1.Items[0], f) + + output, err = exec.Command("kubectl", "-n", "kube-system", "-l", "app=kube-ovn-pinger", "get", "pod", "-o=jsonpath={.items[0].metadata.name}").CombinedOutput() + Expect(err).NotTo(HaveOccurred()) + Expect(output).ShouldNot(BeEmpty()) + + output, err = exec.Command("kubectl", "-n", "kube-system", "exec", "-i", string(output), "--", "/usr/bin/ping", ip0, "-c2").CombinedOutput() + Expect(err).NotTo(HaveOccurred()) + Expect(string(output)).Should(ContainSubstring("0% packet loss")) }) func buildConfigFromFlags(context, kubeconfigPath string) (*rest.Config, error) {