mirror of
https://github.com/alibaba/higress.git
synced 2026-02-06 23:21:08 +08:00
feat: run the specific e2e test with environment variable (#975)
Signed-off-by: Ink33 <Ink33@smlk.org>
This commit is contained in:
@@ -305,7 +305,7 @@ run-higress-e2e-test:
|
||||
kubectl wait --timeout=10m -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=10m -n higress-system deployment/higress-gateway --for=condition=Available
|
||||
go test -v -tags conformance ./test/e2e/e2e_test.go --ingress-class=higress --debug=true --test-area=all
|
||||
go test -v -tags conformance ./test/e2e/e2e_test.go --ingress-class=higress --debug=true --test-area=all --execute-tests=$(TEST_SHORTNAME)
|
||||
|
||||
# run-higress-e2e-test-run starts to run ingress e2e conformance tests.
|
||||
.PHONY: run-higress-e2e-test-run
|
||||
@@ -315,7 +315,7 @@ run-higress-e2e-test-run:
|
||||
kubectl wait --timeout=10m -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=10m -n higress-system deployment/higress-gateway --for=condition=Available
|
||||
go test -v -tags conformance ./test/e2e/e2e_test.go --ingress-class=higress --debug=true --test-area=run
|
||||
go test -v -tags conformance ./test/e2e/e2e_test.go --ingress-class=higress --debug=true --test-area=run --execute-tests=$(TEST_SHORTNAME)
|
||||
|
||||
# run-higress-e2e-test-clean starts to clean ingress e2e tests.
|
||||
.PHONY: run-higress-e2e-test-clean
|
||||
@@ -345,7 +345,7 @@ run-higress-e2e-test-wasmplugin:
|
||||
kubectl wait --timeout=10m -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=10m -n higress-system deployment/higress-gateway --for=condition=Available
|
||||
go test -v -tags conformance ./test/e2e/e2e_test.go -isWasmPluginTest=true -wasmPluginType=$(PLUGIN_TYPE) -wasmPluginName=$(PLUGIN_NAME) --ingress-class=higress --debug=true --test-area=all
|
||||
go test -v -tags conformance ./test/e2e/e2e_test.go -isWasmPluginTest=true -wasmPluginType=$(PLUGIN_TYPE) -wasmPluginName=$(PLUGIN_NAME) --ingress-class=higress --debug=true --test-area=all --execute-tests=$(TEST_SHORTNAME)
|
||||
|
||||
# run-higress-e2e-test-wasmplugin-run starts to run ingress e2e conformance tests.
|
||||
.PHONY: run-higress-e2e-test-wasmplugin-run
|
||||
@@ -355,7 +355,7 @@ run-higress-e2e-test-wasmplugin-run:
|
||||
kubectl wait --timeout=10m -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=10m -n higress-system deployment/higress-gateway --for=condition=Available
|
||||
go test -v -tags conformance ./test/e2e/e2e_test.go -isWasmPluginTest=true -wasmPluginType=$(PLUGIN_TYPE) -wasmPluginName=$(PLUGIN_NAME) --ingress-class=higress --debug=true --test-area=run
|
||||
go test -v -tags conformance ./test/e2e/e2e_test.go -isWasmPluginTest=true -wasmPluginType=$(PLUGIN_TYPE) -wasmPluginName=$(PLUGIN_NAME) --ingress-class=higress --debug=true --test-area=run --execute-tests=$(TEST_SHORTNAME)
|
||||
|
||||
# run-higress-e2e-test-wasmplugin-clean starts to clean ingress e2e tests.
|
||||
.PHONY: run-higress-e2e-test-wasmplugin-clean
|
||||
|
||||
@@ -22,6 +22,7 @@ Higress provides make target to run ingress api conformance tests and wasmplugin
|
||||
+ Build ALL GO WasmPlugins for testing: `make higress-wasmplugin-test`
|
||||
+ Only build one GO WasmPlugin for testing: `PLUGIN_NAME=request-block make higress-wasmplugin-test`
|
||||
+ Only build one CPP WasmPlugin for testing: `PLUGIN_TYPE=CPP PLUGIN_NAME=key_auth make higress-wasmplugin-test`
|
||||
+ Only run the specific test, splited by comma `TEST_SHORTNAME=WasmPluginsIPRestrictionAllow,WasmPluginsIPRestrictionDeny make higress-wasmplugin-test`
|
||||
|
||||
It can be divided into below steps:
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ Higress 提供了运行 Ingress API 一致性测试和 wasmplugin 测试的 make
|
||||
+ 为测试构建所有 GO WasmPlugins: `make higress-wasmplugin-test`
|
||||
+ 仅为一个 GO WasmPlugin 构建测试: `PLUGIN_NAME=request-block make higress-wasmplugin-test`
|
||||
+ 仅为一个 CPP WasmPlugin 构建测试: `PLUGIN_TYPE=CPP PLUGIN_NAME=key_auth make higress-wasmplugin-test`
|
||||
+ 仅运行指定测试,用逗号分隔 `TEST_SHORTNAME=WasmPluginsIPRestrictionAllow,WasmPluginsIPRestrictionDeny make higress-wasmplugin-test`
|
||||
|
||||
可以分为以下步骤:
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ var (
|
||||
CleanupBaseResources = flag.Bool("cleanup-base-resources", true, "Whether to cleanup base test resources after the run")
|
||||
SupportedFeatures = flag.String("supported-features", "", "Supported features included in conformance tests suites")
|
||||
ExemptFeatures = flag.String("exempt-features", "", "Exempt Features excluded from conformance tests suites")
|
||||
ExecuteTests = flag.String("execute-tests", "", "Execute the specific conformance tests")
|
||||
IsWasmPluginTest = flag.Bool("isWasmPluginTest", false, "Determine if run wasm plugin conformance test")
|
||||
WasmPluginType = flag.String("wasmPluginType", "GO", "Define wasm plugin type, currently supports GO, CPP")
|
||||
WasmPluginName = flag.String("wasmPluginName", "", "Define wasm plugin name")
|
||||
|
||||
@@ -15,6 +15,7 @@ package suite
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/alibaba/higress/test/e2e/conformance/utils/config"
|
||||
@@ -43,6 +44,7 @@ type ConformanceTestSuite struct {
|
||||
BaseManifests []string
|
||||
Applier kubernetes.Applier
|
||||
SkipTests sets.Set
|
||||
ExecuteTests sets.Set
|
||||
TimeoutConfig config.TimeoutConfig
|
||||
SupportedFeatures sets.Set
|
||||
}
|
||||
@@ -51,6 +53,7 @@ type ConformanceTestSuite struct {
|
||||
type Options struct {
|
||||
SupportedFeatures sets.Set
|
||||
ExemptFeatures sets.Set
|
||||
ExecuteTests string
|
||||
|
||||
EnableAllSupportedFeatures bool
|
||||
Client client.Client
|
||||
@@ -116,6 +119,7 @@ func New(s Options) *ConformanceTestSuite {
|
||||
BaseManifests: s.BaseManifests,
|
||||
SupportedFeatures: s.SupportedFeatures,
|
||||
GatewayAddress: s.GatewayAddress,
|
||||
ExecuteTests: sets.NewSet(),
|
||||
Applier: kubernetes.Applier{
|
||||
NamespaceLabels: s.NamespaceLabels,
|
||||
},
|
||||
@@ -134,6 +138,13 @@ func New(s Options) *ConformanceTestSuite {
|
||||
}
|
||||
}
|
||||
|
||||
testNames := strings.Split(s.ExecuteTests, ",")
|
||||
for i := range testNames {
|
||||
if testNames[i] != "" {
|
||||
suite.ExecuteTests = suite.ExecuteTests.Insert(testNames[i])
|
||||
}
|
||||
}
|
||||
|
||||
return suite
|
||||
}
|
||||
|
||||
@@ -232,6 +243,10 @@ func (test *ConformanceTest) Run(t *testing.T, suite *ConformanceTestSuite) {
|
||||
t.Skipf("🏊🏼 Skipping %s: test explicitly skipped", test.ShortName)
|
||||
}
|
||||
|
||||
if len(suite.ExecuteTests) > 0 && !suite.ExecuteTests.Contains(test.ShortName) {
|
||||
t.Skipf("🏊🏼 Skipping %s: test explicitly skipped", test.ShortName)
|
||||
}
|
||||
|
||||
t.Logf("🔥 Running Conformance Test: %s", test.ShortName)
|
||||
|
||||
for _, manifestLocation := range test.PreDeleteRs {
|
||||
|
||||
@@ -50,6 +50,7 @@ func TestHigressConformanceTests(t *testing.T) {
|
||||
WasmPluginName: *flags.WasmPluginName,
|
||||
WasmPluginType: *flags.WasmPluginType,
|
||||
},
|
||||
ExecuteTests: *flags.ExecuteTests,
|
||||
GatewayAddress: "localhost",
|
||||
EnableAllSupportedFeatures: true,
|
||||
IsEnvoyConfigTest: *flags.IsEnvoyConfigTest,
|
||||
|
||||
Reference in New Issue
Block a user