-
Notifications
You must be signed in to change notification settings - Fork 136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: print test name instead of config name #1961
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -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) | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The update to use - return fmt.Errorf("test run '%s' failed: %v", tr.config.name, err)
+ return fmt.Errorf("test run '%s' using step choice '%s' failed: %v", tr.config.name, tr.stepChoice.name, err) Committable suggestion
Suggested change
|
||||||||||||
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}, | ||||||||||||
} | ||||||||||||
} | ||||||||||||
|
||||||||||||
|
@@ -133,8 +133,10 @@ 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,12 +146,14 @@ func (tr *TestRunner) Report() string { | |||||||||||
return fmt.Sprintf(` | ||||||||||||
------------------------------------------ | ||||||||||||
Test name : %s | ||||||||||||
Config: %s | ||||||||||||
Target: %s | ||||||||||||
- Status: %s | ||||||||||||
- Result: %s | ||||||||||||
- Duration: %s | ||||||||||||
- StartTime: %s | ||||||||||||
------------------------------------------`, | ||||||||||||
tr.stepChoice.name, | ||||||||||||
tr.config.name, | ||||||||||||
tr.target.Info(), | ||||||||||||
tr.result.Status, | ||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Direct assignment of
stepChoices[tc]
tosteps
simplifies the code and ensures correct usage. Consider adding more detailed logging for better traceability.Committable suggestion