feat: run the specific e2e test with environment variable (#975)

Signed-off-by: Ink33 <Ink33@smlk.org>
This commit is contained in:
Ink33
2024-05-23 17:36:24 +08:00
committed by GitHub
parent 78418b50ff
commit 2fee28d4e8
6 changed files with 23 additions and 4 deletions

View File

@@ -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")

View File

@@ -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 {