From 01dfc77c415752d87372ed95af163f20deec02d5 Mon Sep 17 00:00:00 2001
From: Philip Offtermatt
Date: Wed, 12 Jun 2024 17:37:55 +0200
Subject: [PATCH 1/2] Fix: print test name instead of config name
---
tests/e2e/main.go | 11 +++++++----
tests/e2e/test_runner.go | 20 ++++++++++----------
2 files changed, 17 insertions(+), 14 deletions(-)
diff --git a/tests/e2e/main.go b/tests/e2e/main.go
index 5a1ee681e0..2cf0f33a6f 100644
--- a/tests/e2e/main.go
+++ b/tests/e2e/main.go
@@ -277,7 +277,7 @@ func parseArguments() (err error) {
type testStepsWithConfig struct {
config TestConfigType
- steps []Step
+ steps StepChoice
}
func getTestCases(selectedPredefinedTests, selectedTestFiles TestSet, providerVersions,
@@ -316,13 +316,12 @@ func getTestCases(selectedPredefinedTests, selectedTestFiles TestSet, providerVe
log.Fatalf("Step choice '%s' not found.\nsee usage info:\n%s", tc, getTestCaseUsageString())
}
- testSteps := stepChoices[tc].steps
if testConfig == "" {
testConfig = stepChoices[tc].testConfig
}
tests = append(tests, testStepsWithConfig{
config: testConfig,
- steps: testSteps,
+ steps: stepChoices[tc],
},
)
}
@@ -351,7 +350,11 @@ func getTestCases(selectedPredefinedTests, selectedTestFiles TestSet, providerVe
tests = append(tests, testStepsWithConfig{
config: testConfig,
- steps: testCase,
+ steps: StepChoice{
+ name: testFileName,
+ steps: testCase,
+ description: fmt.Sprintf("Steps from file %s", testFileName),
+ },
})
}
diff --git a/tests/e2e/test_runner.go b/tests/e2e/test_runner.go
index 7c02dd6d2d..708807eb08 100644
--- a/tests/e2e/test_runner.go
+++ b/tests/e2e/test_runner.go
@@ -19,7 +19,7 @@ const (
// It sets up the test environment and the test driver to run the tests
type TestRunner struct {
config TestConfig
- steps []Step
+ stepChoice StepChoice
testDriver TestCaseDriver
target ExecutionTarget
verbose bool
@@ -86,7 +86,7 @@ func (tr *TestRunner) Run() error {
}
tr.testDriver = GetTestCaseDriver(tr.config)
- err = tr.testDriver.Run(tr.steps, tr.target, tr.verbose)
+ err = tr.testDriver.Run(tr.stepChoice.steps, tr.target, tr.verbose)
if err != nil {
tr.result.Failed()
// not tearing down environment for troubleshooting reasons on container
@@ -118,13 +118,13 @@ func (tr *TestRunner) Setup(testCfg TestConfig) error {
return nil
}
-func CreateTestRunner(config TestConfig, steps []Step, target ExecutionTarget, verbose bool) TestRunner {
+func CreateTestRunner(config TestConfig, stepChoice StepChoice, target ExecutionTarget, verbose bool) TestRunner {
return TestRunner{
- target: target,
- steps: steps,
- config: config,
- verbose: verbose,
- result: TestResult{Status: TEST_STATUS_NOTRUN},
+ target: target,
+ stepChoice: stepChoice,
+ config: config,
+ verbose: verbose,
+ result: TestResult{Status: TEST_STATUS_NOTRUN},
}
}
@@ -135,7 +135,7 @@ func (tr *TestRunner) Info() string {
Test name : %s
Target: %s
------------------------------------------`,
- tr.config.name,
+ tr.stepChoice.name,
tr.target.Info(),
)
}
@@ -150,7 +150,7 @@ Target: %s
- Duration: %s
- StartTime: %s
------------------------------------------`,
- tr.config.name,
+ tr.stepChoice.name,
tr.target.Info(),
tr.result.Status,
tr.result.Result,
From f34528ddc8e7d0cd396c54ae8780956d467d1d41 Mon Sep 17 00:00:00 2001
From: Philip Offtermatt
Date: Wed, 12 Jun 2024 17:39:15 +0200
Subject: [PATCH 2/2] Add the config back in the report
---
tests/e2e/test_runner.go | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tests/e2e/test_runner.go b/tests/e2e/test_runner.go
index 708807eb08..c3ced5ab61 100644
--- a/tests/e2e/test_runner.go
+++ b/tests/e2e/test_runner.go
@@ -133,9 +133,11 @@ func (tr *TestRunner) Info() string {
return fmt.Sprintf(`
------------------------------------------
Test name : %s
+Config: %s
Target: %s
------------------------------------------`,
tr.stepChoice.name,
+ tr.config.name,
tr.target.Info(),
)
}
@@ -144,6 +146,7 @@ func (tr *TestRunner) Report() string {
return fmt.Sprintf(`
------------------------------------------
Test name : %s
+Config: %s
Target: %s
- Status: %s
- Result: %s
@@ -151,6 +154,7 @@ Target: %s
- StartTime: %s
------------------------------------------`,
tr.stepChoice.name,
+ tr.config.name,
tr.target.Info(),
tr.result.Status,
tr.result.Result,