Skip to content

Commit

Permalink
e2e: run specs in parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangzujian committed Feb 23, 2023
1 parent f68044b commit e5b7c43
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 51 deletions.
54 changes: 29 additions & 25 deletions Makefile.e2e
Original file line number Diff line number Diff line change
Expand Up @@ -33,39 +33,43 @@ K8S_CONFORMANCE_E2E_FOCUS += "sig-network.*Feature:IPv6DualStack"
endif

define ginkgo_option
--ginkgo.$(1)=$(shell echo '$(2)' | sed -E 's/^[[:space:]]+//' | sed -E 's/"[[:space:]]+"/" --ginkgo.$(1)="/g')
--$(1)=$(shell echo '$(2)' | sed -E 's/^[[:space:]]+//' | sed -E 's/"[[:space:]]+"/" --$(1)="/g')
endef

.PHONY: e2e
e2e: kube-ovn-conformance-e2e

.PHONY: e2e-compile
e2e-compile:
go test ./test/e2e/k8s-network -c -o test/e2e/k8s-network/e2e.test
go test ./test/e2e/kube-ovn -c -o test/e2e/kube-ovn/e2e.test
go test ./test/e2e/ovn-ic -c -o test/e2e/ovn-ic/e2e.test
go test ./test/e2e/lb-svc -c -o test/e2e/lb-svc/e2e.test
go test ./test/e2e/security -c -o test/e2e/security/e2e.test
ginkgo build ./test/e2e/k8s-network
ginkgo build ./test/e2e/kube-ovn
ginkgo build ./test/e2e/ovn-ic
ginkgo build ./test/e2e/lb-svc
ginkgo build ./test/e2e/ovn-eip
ginkgo build ./test/e2e/security

.PHONY: k8s-conformance-e2e
k8s-conformance-e2e:
go test ./test/e2e/k8s-network -c -o test/e2e/k8s-network/e2e.test
./test/e2e/k8s-network/e2e.test --ginkgo.timeout=1h \
ginkgo build ./test/e2e/k8s-network
ginkgo -p --randomize-all --timeout=1h \
$(call ginkgo_option,focus,$(K8S_CONFORMANCE_E2E_FOCUS)) \
$(call ginkgo_option,skip,$(K8S_CONFORMANCE_E2E_SKIP))
$(call ginkgo_option,skip,$(K8S_CONFORMANCE_E2E_SKIP)) \
./test/e2e/k8s-network/k8s-network.test

.PHONY: k8s-netpol-legacy-e2e
k8s-netpol-legacy-e2e:
go test ./test/e2e/k8s-network -c -o test/e2e/k8s-network/e2e.test
./test/e2e/k8s-network/e2e.test --ginkgo.timeout=2h \
$(call ginkgo_option,focus,$(K8S_NETPOL_LEGACY_E2E_FOCUS))
ginkgo build ./test/e2e/k8s-network
ginkgo -p --randomize-all --timeout=2h \
$(call ginkgo_option,focus,$(K8S_NETPOL_LEGACY_E2E_FOCUS)) \
./test/e2e/k8s-network/k8s-network.test

.PHONY: k8s-netpol-e2e
k8s-netpol-e2e:
go test ./test/e2e/k8s-network -c -o test/e2e/k8s-network/e2e.test
./test/e2e/k8s-network/e2e.test --ginkgo.timeout=2h \
ginkgo build ./test/e2e/k8s-network
ginkgo -p --randomize-all --timeout=2h \
$(call ginkgo_option,focus,$(K8S_NETPOL_E2E_FOCUS)) \
$(call ginkgo_option,skip,$(K8S_NETPOL_E2E_SKIP))
$(call ginkgo_option,skip,$(K8S_NETPOL_E2E_SKIP)) \
./test/e2e/k8s-network/k8s-network.test

.PHONY: cyclonus-netpol-e2e
cyclonus-netpol-e2e:
Expand All @@ -83,40 +87,40 @@ cyclonus-netpol-e2e:

.PHONY: kube-ovn-conformance-e2e
kube-ovn-conformance-e2e:
go test ./test/e2e/kube-ovn -c -o test/e2e/kube-ovn/e2e.test
ginkgo build ./test/e2e/kube-ovn
E2E_BRANCH=$(E2E_BRANCH) \
E2E_IP_FAMILY=$(E2E_IP_FAMILY) \
E2E_NETWORK_MODE=$(E2E_NETWORK_MODE) \
./test/e2e/kube-ovn/e2e.test --ginkgo.focus=CNI:Kube-OVN
ginkgo -p --randomize-all --focus="CNI:Kube-OVN" ./test/e2e/kube-ovn/kube-ovn.test

.PHONY: kube-ovn-ic-conformance-e2e
kube-ovn-ic-conformance-e2e:
go test ./test/e2e/ovn-ic -c -o test/e2e/ovn-ic/e2e.test
ginkgo build ./test/e2e/ovn-ic
E2E_BRANCH=$(E2E_BRANCH) \
E2E_IP_FAMILY=$(E2E_IP_FAMILY) \
E2E_NETWORK_MODE=$(E2E_NETWORK_MODE) \
./test/e2e/ovn-ic/e2e.test --ginkgo.focus=CNI:Kube-OVN
ginkgo -p --randomize-all --focus="CNI:Kube-OVN" ./test/e2e/ovn-ic/ovn-ic.test

.PHONY: kube-ovn-lb-svc-conformance-e2e
kube-ovn-lb-svc-conformance-e2e:
go test ./test/e2e/lb-svc -c -o test/e2e/lb-svc/e2e.test
ginkgo build ./test/e2e/lb-svc
E2E_BRANCH=$(E2E_BRANCH) \
E2E_IP_FAMILY=$(E2E_IP_FAMILY) \
E2E_NETWORK_MODE=$(E2E_NETWORK_MODE) \
./test/e2e/lb-svc/e2e.test --ginkgo.focus=CNI:Kube-OVN
ginkgo -p --randomize-all --focus="CNI:Kube-OVN" ./test/e2e/lb-svc/lb-svc.test

.PHONY: kube-ovn-eip-conformance-e2e
kube-ovn-eip-conformance-e2e:
go test ./test/e2e/ovn-eip -c -o test/e2e/ovn-eip/e2e.test
ginkgo build ./test/e2e/ovn-eip
E2E_BRANCH=$(E2E_BRANCH) \
E2E_IP_FAMILY=$(E2E_IP_FAMILY) \
E2E_NETWORK_MODE=$(E2E_NETWORK_MODE) \
./test/e2e/ovn-eip/e2e.test --ginkgo.focus=CNI:Kube-OVN
ginkgo -p --randomize-all --focus="CNI:Kube-OVN" ./test/e2e/ovn-eip/ovn-eip.test

.PHONY: kube-ovn-security-e2e
kube-ovn-security-e2e:
go test ./test/e2e/security -c -o test/e2e/security/e2e.test
ginkgo build ./test/e2e/security
E2E_BRANCH=$(E2E_BRANCH) \
E2E_IP_FAMILY=$(E2E_IP_FAMILY) \
E2E_NETWORK_MODE=$(E2E_NETWORK_MODE) \
./test/e2e/security/e2e.test --ginkgo.focus=CNI:Kube-OVN
ginkgo -p --randomize-all --focus="CNI:Kube-OVN" ./test/e2e/security/security.test
6 changes: 2 additions & 4 deletions test/e2e/k8s-network/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,13 @@ func init() {
config.CopyFlags(config.Flags, flag.CommandLine)
framework.RegisterCommonFlags(flag.CommandLine)
framework.RegisterClusterFlags(flag.CommandLine)
}

// Parse all the flags
flag.Parse()
func TestE2E(t *testing.T) {
if framework.TestContext.KubeConfig == "" {
framework.TestContext.KubeConfig = filepath.Join(os.Getenv("HOME"), ".kube", "config")
}
framework.AfterReadingAllFlags(&framework.TestContext)
}

func TestE2E(t *testing.T) {
e2e.RunE2ETests(t)
}
6 changes: 2 additions & 4 deletions test/e2e/kube-ovn/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,13 @@ func init() {
config.CopyFlags(config.Flags, flag.CommandLine)
framework.RegisterCommonFlags(flag.CommandLine)
framework.RegisterClusterFlags(flag.CommandLine)
}

// Parse all the flags
flag.Parse()
func TestE2E(t *testing.T) {
if framework.TestContext.KubeConfig == "" {
framework.TestContext.KubeConfig = filepath.Join(os.Getenv("HOME"), ".kube", "config")
}
framework.AfterReadingAllFlags(&framework.TestContext)
}

func TestE2E(t *testing.T) {
e2e.RunE2ETests(t)
}
6 changes: 2 additions & 4 deletions test/e2e/lb-svc/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,14 @@ func init() {
config.CopyFlags(config.Flags, flag.CommandLine)
k8sframework.RegisterCommonFlags(flag.CommandLine)
k8sframework.RegisterClusterFlags(flag.CommandLine)
}

// Parse all the flags
flag.Parse()
func TestE2E(t *testing.T) {
if k8sframework.TestContext.KubeConfig == "" {
k8sframework.TestContext.KubeConfig = filepath.Join(os.Getenv("HOME"), ".kube", "config")
}
k8sframework.AfterReadingAllFlags(&k8sframework.TestContext)
}

func TestE2E(t *testing.T) {
e2e.RunE2ETests(t)
}

Expand Down
6 changes: 2 additions & 4 deletions test/e2e/ovn-eip/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,15 +336,13 @@ func init() {
config.CopyFlags(config.Flags, flag.CommandLine)
k8sframework.RegisterCommonFlags(flag.CommandLine)
k8sframework.RegisterClusterFlags(flag.CommandLine)
}

// Parse all the flags
flag.Parse()
func TestE2E(t *testing.T) {
if k8sframework.TestContext.KubeConfig == "" {
k8sframework.TestContext.KubeConfig = filepath.Join(os.Getenv("HOME"), ".kube", "config")
}
k8sframework.AfterReadingAllFlags(&k8sframework.TestContext)
}

func TestE2E(t *testing.T) {
e2e.RunE2ETests(t)
}
10 changes: 4 additions & 6 deletions test/e2e/ovn-ic/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,22 @@ func init() {
config.CopyFlags(config.Flags, flag.CommandLine)
k8sframework.RegisterCommonFlags(flag.CommandLine)
k8sframework.RegisterClusterFlags(flag.CommandLine)
}

// Parse all the flags
flag.Parse()
func TestE2E(t *testing.T) {
if k8sframework.TestContext.KubeConfig == "" {
k8sframework.TestContext.KubeConfig = filepath.Join(os.Getenv("HOME"), ".kube", "config")
}
k8sframework.AfterReadingAllFlags(&k8sframework.TestContext)

var err error
if clusters, err = kind.ListClusters(); err != nil {
panic(fmt.Sprintf("failed to list kind clusters: %v", err))
t.Fatalf("failed to list kind clusters: %v", err)
}
if len(clusters) < 2 {
panic("no enough kind clusters to run ovn-ic e2e testing")
t.Fatal("no enough kind clusters to run ovn-ic e2e testing")
}
}

func TestE2E(t *testing.T) {
e2e.RunE2ETests(t)
}

Expand Down
6 changes: 2 additions & 4 deletions test/e2e/security/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,14 @@ func init() {
config.CopyFlags(config.Flags, flag.CommandLine)
k8sframework.RegisterCommonFlags(flag.CommandLine)
k8sframework.RegisterClusterFlags(flag.CommandLine)
}

// Parse all the flags
flag.Parse()
func TestE2E(t *testing.T) {
if k8sframework.TestContext.KubeConfig == "" {
k8sframework.TestContext.KubeConfig = filepath.Join(os.Getenv("HOME"), ".kube", "config")
}
k8sframework.AfterReadingAllFlags(&k8sframework.TestContext)
}

func TestE2E(t *testing.T) {
e2e.RunE2ETests(t)
}

Expand Down

0 comments on commit e5b7c43

Please sign in to comment.