Skip to content

Commit

Permalink
Remove repo path from runner
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszcl committed Oct 18, 2024
1 parent 2ccb5c8 commit a8c7fb5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
3 changes: 0 additions & 3 deletions tools/flakeguard/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ var RunTestsCmd = &cobra.Command{
Use: "run",
Short: "Run tests to check if they are flaky",
Run: func(cmd *cobra.Command, args []string) {
repoPath, _ := cmd.Flags().GetString("repo-path")
testPackagesJson, _ := cmd.Flags().GetString("test-packages-json")
testPackagesArg, _ := cmd.Flags().GetStringSlice("test-packages")
runCount, _ := cmd.Flags().GetInt("run-count")
Expand All @@ -37,7 +36,6 @@ var RunTestsCmd = &cobra.Command{

runner := runner.Runner{
Verbose: true,
Dir: repoPath,
RunCount: runCount,
UseRace: useRace,
FailFast: failFast,
Expand Down Expand Up @@ -80,7 +78,6 @@ var RunTestsCmd = &cobra.Command{
}

func init() {
RunTestsCmd.Flags().StringP("repo-path", "r", ".", "Path to the Git repository")
RunTestsCmd.Flags().String("test-packages-json", "", "JSON-encoded string of test packages")
RunTestsCmd.Flags().StringSlice("test-packages", nil, "Comma-separated list of test packages to run")
RunTestsCmd.Flags().IntP("run-count", "c", 1, "Number of times to run the tests")
Expand Down
11 changes: 5 additions & 6 deletions tools/flakeguard/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@ import (
)

type Runner struct {
Verbose bool // If true, provides detailed logging.
Dir string // Directory to run commands in.
RunCount int // Number of times to run the tests.
UseRace bool // Enable race detector.
FailFast bool // Stop on first test failure.
Verbose bool // If true, provides detailed logging.
RunCount int // Number of times to run the tests.
UseRace bool // Enable race detector.
FailFast bool // Stop on first test failure.
}

// RunTests executes the tests for each provided package and aggregates all results.
Expand All @@ -36,6 +35,7 @@ func (r *Runner) RunTests(packages []string) ([]reports.TestResult, error) {
}
}

// TODO: make sure the test name includes package name
return parseTestResults(jsonOutputs)
}

Expand Down Expand Up @@ -63,7 +63,6 @@ func (r *Runner) runTestPackage(testPackage string) ([]byte, error) {
cmd := exec.Command("go", args...)

// cmd.Env = append(cmd.Env, "GOFLAGS=-extldflags=-Wl,-ld_classic") // Ensure modules are enabled
cmd.Dir = r.Dir
var out bytes.Buffer
cmd.Stdout = &out
cmd.Stderr = &out
Expand Down

0 comments on commit a8c7fb5

Please sign in to comment.