Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix ovnic e2e #1763

Merged
merged 1 commit into from
Aug 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 16 additions & 0 deletions test/e2e-ovnic/e2e_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package e2e_ovnic_test
import (
"context"
"fmt"
"net"
"os"
"os/exec"
"strings"
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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) {
Expand Down