Skip to content

Commit 5073317

Browse files
committed
rename
1 parent dd68a64 commit 5073317

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

tools/flakeguard/cmd/run.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ import (
66
"fmt"
77
"os"
88
"os/exec"
9+
"time"
910

11+
"github.com/briandowns/spinner"
1012
"github.com/rs/zerolog/log"
1113
"github.com/smartcontractkit/chainlink-testing-framework/tools/flakeguard/reports"
1214
"github.com/smartcontractkit/chainlink-testing-framework/tools/flakeguard/runner"
@@ -133,11 +135,15 @@ var RunTestsCmd = &cobra.Command{
133135
// Run the tests
134136
var mainResults []reports.TestResult
135137
if len(testCmdStrings) > 0 {
138+
s := spinner.New(spinner.CharSets[14], 100*time.Millisecond)
139+
s.Suffix = " Running custom test command..."
140+
s.Start()
136141
mainResults, err = testRunner.RunTestCmd(testCmdStrings)
137142
if err != nil {
138143
log.Fatal().Err(err).Msg("Error running custom test command")
139144
flushSummaryAndExit(ErrorExitCode)
140145
}
146+
s.Stop()
141147
} else {
142148
mainResults, err = testRunner.RunTestPackages(testPackages)
143149
if err != nil {

tools/flakeguard/runner/runner.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ func (r *Runner) runTestPackage(packageName string) (string, bool, error) {
186186

187187
// runCmd runs the user-supplied command once, captures its JSON output,
188188
// and returns the temp file path, whether the test passed, and an error if any.
189-
func (r *Runner) runCmd(testCmd []string, runIndex int) (tempFilePath string, passed bool, err error) {
189+
func (r *Runner) runCmd(testCmd []string, runIndex int) (outputPath string, passed bool, err error) {
190190
// Create temp file for JSON output
191191
tmpFile, err := os.CreateTemp("", fmt.Sprintf("test-output-cmd-run%d-*.json", runIndex+1))
192192
if err != nil {
@@ -215,7 +215,7 @@ func (r *Runner) runCmd(testCmd []string, runIndex int) (tempFilePath string, pa
215215

216216
err = cmd.Run()
217217

218-
tempFilePath = tmpFile.Name()
218+
outputPath = tmpFile.Name()
219219

220220
// Determine pass/fail from exit code
221221
type exitCoder interface {
@@ -229,7 +229,6 @@ func (r *Runner) runCmd(testCmd []string, runIndex int) (tempFilePath string, pa
229229
return
230230
} else if err != nil {
231231
// Some other error that doesn't implement ExitCode() => real error
232-
tempFilePath = ""
233232
err = fmt.Errorf("error running test command: %w", err)
234233
return
235234
}
@@ -614,7 +613,6 @@ func (r *Runner) transformTestOutputFiles(filePaths []string) ([]string, error)
614613
}
615614
// Use the transformed file path.
616615
transformedPaths[i] = outFile.Name()
617-
os.Remove(origPath)
618616
}
619617
return transformedPaths, nil
620618
}

0 commit comments

Comments
 (0)