mirror of
https://github.com/alibaba/higress.git
synced 2026-06-09 04:37:31 +08:00
chore: some clean-up to e2e tests (#162)
Signed-off-by: bitliu <bitliu@tencent.com>
This commit is contained in:
@@ -182,7 +182,7 @@ gateway-conformance-test:
|
|||||||
|
|
||||||
# ingress-conformance-test runs ingress api conformance tests.
|
# ingress-conformance-test runs ingress api conformance tests.
|
||||||
.PHONY: ingress-conformance-test
|
.PHONY: ingress-conformance-test
|
||||||
ingress-conformance-test: $(tools/kind) delete-cluster create-cluster kube-load-image install-dev run-ingress-e2e-test delete-cluster
|
ingress-conformance-test: $(tools/kind) delete-cluster create-cluster docker-build kube-load-image install-dev run-ingress-e2e-test delete-cluster
|
||||||
|
|
||||||
# create-cluster creates a kube cluster with kind.
|
# create-cluster creates a kube cluster with kind.
|
||||||
.PHONY: create-cluster
|
.PHONY: create-cluster
|
||||||
@@ -196,7 +196,7 @@ delete-cluster: $(tools/kind) ## Delete kind cluster.
|
|||||||
|
|
||||||
# kube-load-image loads a local built docker image into kube cluster.
|
# kube-load-image loads a local built docker image into kube cluster.
|
||||||
.PHONY: kube-load-image
|
.PHONY: kube-load-image
|
||||||
kube-load-image: docker-build $(tools/kind) ## Install the EG image to a kind cluster using the provided $IMAGE and $TAG.
|
kube-load-image: $(tools/kind) ## Install the EG image to a kind cluster using the provided $IMAGE and $TAG.
|
||||||
tools/hack/kind-load-image.sh higress-registry.cn-hangzhou.cr.aliyuncs.com/higress/higress $(TAG)
|
tools/hack/kind-load-image.sh higress-registry.cn-hangzhou.cr.aliyuncs.com/higress/higress $(TAG)
|
||||||
|
|
||||||
# run-ingress-e2e-test starts to run ingress e2e tests.
|
# run-ingress-e2e-test starts to run ingress e2e tests.
|
||||||
@@ -207,4 +207,4 @@ run-ingress-e2e-test:
|
|||||||
kubectl wait --timeout=5m -n higress-system deployment/higress-controller --for=condition=Available
|
kubectl wait --timeout=5m -n higress-system deployment/higress-controller --for=condition=Available
|
||||||
@echo -e "\n\033[36mWaiting higress-gateway to be ready...\033[0m\n"
|
@echo -e "\n\033[36mWaiting higress-gateway to be ready...\033[0m\n"
|
||||||
kubectl wait --timeout=5m -n higress-system deployment/higress-gateway --for=condition=Available
|
kubectl wait --timeout=5m -n higress-system deployment/higress-gateway --for=condition=Available
|
||||||
go test -v -tags conformance ./test/ingress/e2e_test.go --ingress-class=higress --debug=true --use-unique-ports=true
|
go test -v -tags conformance ./test/ingress/e2e_test.go --ingress-class=higress --debug=true
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ func init() {
|
|||||||
|
|
||||||
var HTTPRouteSimpleSameNamespace = suite.ConformanceTest{
|
var HTTPRouteSimpleSameNamespace = suite.ConformanceTest{
|
||||||
ShortName: "HTTPRouteSimpleSameNamespace",
|
ShortName: "HTTPRouteSimpleSameNamespace",
|
||||||
Description: "A single Ingress in the higress-conformance-infra namespace attaches to a Gateway in the same namespace",
|
Description: "A single Ingress in the higress-conformance-infra namespace demonstrates basic routing ability",
|
||||||
Manifests: []string{"tests/httproute-simple-same-namespace.yaml"},
|
Manifests: []string{"tests/httproute-simple-same-namespace.yaml"},
|
||||||
Test: func(t *testing.T, suite *suite.ConformanceTestSuite) {
|
Test: func(t *testing.T, suite *suite.ConformanceTestSuite) {
|
||||||
|
|
||||||
|
|||||||
@@ -39,15 +39,8 @@ import (
|
|||||||
// them to the Kubernetes cluster.
|
// them to the Kubernetes cluster.
|
||||||
type Applier struct {
|
type Applier struct {
|
||||||
NamespaceLabels map[string]string
|
NamespaceLabels map[string]string
|
||||||
// ValidUniqueListenerPorts maps each listener port of each Gateway in the
|
|
||||||
// manifests to a valid, unique port. There must be as many
|
|
||||||
// ValidUniqueListenerPorts as there are listeners in the set of manifests.
|
|
||||||
// For example, given two Gateways, each with 2 listeners, there should be
|
|
||||||
// four ValidUniqueListenerPorts.
|
|
||||||
// If empty or nil, ports are not modified.
|
|
||||||
ValidUniqueListenerPorts []int
|
|
||||||
|
|
||||||
// IngressClass will be used as the spec.gatewayClassName when applying Gateway resources
|
// IngressClass will be used as the spec.ingressClassName when applying Ingress resources
|
||||||
IngressClass string
|
IngressClass string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -87,13 +87,6 @@ type Options struct {
|
|||||||
RoundTripper roundtripper.RoundTripper
|
RoundTripper roundtripper.RoundTripper
|
||||||
BaseManifests string
|
BaseManifests string
|
||||||
NamespaceLabels map[string]string
|
NamespaceLabels map[string]string
|
||||||
// ValidUniqueListenerPorts maps each listener port of each Gateway in the
|
|
||||||
// manifests to a valid, unique port. There must be as many
|
|
||||||
// ValidUniqueListenerPorts as there are listeners in the set of manifests.
|
|
||||||
// For example, given two Gateways, each with 2 listeners, there should be
|
|
||||||
// four ValidUniqueListenerPorts.
|
|
||||||
// If empty or nil, ports are not modified.
|
|
||||||
ValidUniqueListenerPorts []int
|
|
||||||
|
|
||||||
// CleanupBaseResources indicates whether or not the base test
|
// CleanupBaseResources indicates whether or not the base test
|
||||||
// resources such as Gateways should be cleaned up after the run.
|
// resources such as Gateways should be cleaned up after the run.
|
||||||
@@ -130,8 +123,7 @@ func New(s Options) *ConformanceTestSuite {
|
|||||||
BaseManifests: s.BaseManifests,
|
BaseManifests: s.BaseManifests,
|
||||||
GatewayAddress: s.GatewayAddress,
|
GatewayAddress: s.GatewayAddress,
|
||||||
Applier: kubernetes.Applier{
|
Applier: kubernetes.Applier{
|
||||||
NamespaceLabels: s.NamespaceLabels,
|
NamespaceLabels: s.NamespaceLabels,
|
||||||
ValidUniqueListenerPorts: s.ValidUniqueListenerPorts,
|
|
||||||
},
|
},
|
||||||
SupportedFeatures: s.SupportedFeatures,
|
SupportedFeatures: s.SupportedFeatures,
|
||||||
TimeoutConfig: s.TimeoutConfig,
|
TimeoutConfig: s.TimeoutConfig,
|
||||||
|
|||||||
@@ -1,6 +1,3 @@
|
|||||||
//go:build conformance
|
|
||||||
// +build conformance
|
|
||||||
|
|
||||||
// Copyright (c) 2022 Alibaba Group Holding Ltd.
|
// Copyright (c) 2022 Alibaba Group Holding Ltd.
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@@ -30,8 +27,6 @@ import (
|
|||||||
"sigs.k8s.io/controller-runtime/pkg/client/config"
|
"sigs.k8s.io/controller-runtime/pkg/client/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
var useUniquePorts = flag.Bool("use-unique-ports", true, "whether to use unique ports")
|
|
||||||
|
|
||||||
func TestHigressConformanceTests(t *testing.T) {
|
func TestHigressConformanceTests(t *testing.T) {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
@@ -43,28 +38,20 @@ func TestHigressConformanceTests(t *testing.T) {
|
|||||||
|
|
||||||
require.NoError(t, v1.AddToScheme(client.Scheme()))
|
require.NoError(t, v1.AddToScheme(client.Scheme()))
|
||||||
|
|
||||||
validUniqueListenerPorts := []int{
|
|
||||||
80,
|
|
||||||
443,
|
|
||||||
}
|
|
||||||
|
|
||||||
if !*useUniquePorts {
|
|
||||||
validUniqueListenerPorts = []int{}
|
|
||||||
}
|
|
||||||
|
|
||||||
cSuite := suite.New(suite.Options{
|
cSuite := suite.New(suite.Options{
|
||||||
Client: client,
|
Client: client,
|
||||||
IngressClassName: *flags.IngressClassName,
|
IngressClassName: *flags.IngressClassName,
|
||||||
Debug: *flags.ShowDebug,
|
Debug: *flags.ShowDebug,
|
||||||
CleanupBaseResources: *flags.CleanupBaseResources,
|
CleanupBaseResources: *flags.CleanupBaseResources,
|
||||||
ValidUniqueListenerPorts: validUniqueListenerPorts,
|
SupportedFeatures: map[suite.SupportedFeature]bool{},
|
||||||
SupportedFeatures: map[suite.SupportedFeature]bool{},
|
GatewayAddress: "localhost",
|
||||||
GatewayAddress: "localhost",
|
|
||||||
})
|
})
|
||||||
|
|
||||||
cSuite.Setup(t)
|
cSuite.Setup(t)
|
||||||
higressTests := []suite.ConformanceTest{
|
higressTests := []suite.ConformanceTest{
|
||||||
tests.HTTPRouteSimpleSameNamespace,
|
tests.HTTPRouteSimpleSameNamespace,
|
||||||
tests.HTTPRouteHostNameSameNamespace,
|
tests.HTTPRouteHostNameSameNamespace,
|
||||||
}
|
}
|
||||||
|
|
||||||
cSuite.Run(t, higressTests)
|
cSuite.Run(t, higressTests)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user