chore: some clean-up to e2e tests (#162)

Signed-off-by: bitliu <bitliu@tencent.com>
This commit is contained in:
Xunzhuo
2023-02-06 13:30:51 +08:00
committed by GitHub
parent b000bc6ce9
commit ca0d62c91a
5 changed files with 14 additions and 42 deletions

View File

@@ -182,7 +182,7 @@ gateway-conformance-test:
# ingress-conformance-test runs ingress api conformance tests.
.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.
.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.
.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)
# 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
@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
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

View File

@@ -27,7 +27,7 @@ func init() {
var HTTPRouteSimpleSameNamespace = suite.ConformanceTest{
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"},
Test: func(t *testing.T, suite *suite.ConformanceTestSuite) {

View File

@@ -39,15 +39,8 @@ import (
// them to the Kubernetes cluster.
type Applier struct {
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
}

View File

@@ -87,13 +87,6 @@ type Options struct {
RoundTripper roundtripper.RoundTripper
BaseManifests 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
// resources such as Gateways should be cleaned up after the run.
@@ -130,8 +123,7 @@ func New(s Options) *ConformanceTestSuite {
BaseManifests: s.BaseManifests,
GatewayAddress: s.GatewayAddress,
Applier: kubernetes.Applier{
NamespaceLabels: s.NamespaceLabels,
ValidUniqueListenerPorts: s.ValidUniqueListenerPorts,
NamespaceLabels: s.NamespaceLabels,
},
SupportedFeatures: s.SupportedFeatures,
TimeoutConfig: s.TimeoutConfig,

View File

@@ -1,6 +1,3 @@
//go:build conformance
// +build conformance
// Copyright (c) 2022 Alibaba Group Holding Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -30,8 +27,6 @@ import (
"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) {
flag.Parse()
@@ -43,28 +38,20 @@ func TestHigressConformanceTests(t *testing.T) {
require.NoError(t, v1.AddToScheme(client.Scheme()))
validUniqueListenerPorts := []int{
80,
443,
}
if !*useUniquePorts {
validUniqueListenerPorts = []int{}
}
cSuite := suite.New(suite.Options{
Client: client,
IngressClassName: *flags.IngressClassName,
Debug: *flags.ShowDebug,
CleanupBaseResources: *flags.CleanupBaseResources,
ValidUniqueListenerPorts: validUniqueListenerPorts,
SupportedFeatures: map[suite.SupportedFeature]bool{},
GatewayAddress: "localhost",
Client: client,
IngressClassName: *flags.IngressClassName,
Debug: *flags.ShowDebug,
CleanupBaseResources: *flags.CleanupBaseResources,
SupportedFeatures: map[suite.SupportedFeature]bool{},
GatewayAddress: "localhost",
})
cSuite.Setup(t)
higressTests := []suite.ConformanceTest{
tests.HTTPRouteSimpleSameNamespace,
tests.HTTPRouteHostNameSameNamespace,
}
cSuite.Run(t, higressTests)
}