Skip to content

Commit

Permalink
Remove separate flag for run all
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszcl committed Nov 12, 2024
1 parent fae9ddc commit d5a4c34
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
2 changes: 0 additions & 2 deletions tools/flakeguard/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ var RunTestsCmd = &cobra.Command{
projectPath, _ := cmd.Flags().GetString("project-path")
testPackagesJson, _ := cmd.Flags().GetString("test-packages-json")
testPackagesArg, _ := cmd.Flags().GetStringSlice("test-packages")
runAllPackages, _ := cmd.Flags().GetBool("run-all-packages")
runCount, _ := cmd.Flags().GetInt("run-count")
useRace, _ := cmd.Flags().GetBool("race")
outputPath, _ := cmd.Flags().GetString("output-json")
Expand Down Expand Up @@ -50,7 +49,6 @@ var RunTestsCmd = &cobra.Command{
UseRace: useRace,
FailFast: threshold == 1.0, // Fail test on first test run if threshold is 1.0
SkipTests: skipTests,
RunAllTestPackages: runAllPackages,
SelectedTestPackages: testPackages,
}

Expand Down
8 changes: 1 addition & 7 deletions tools/flakeguard/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,14 @@ type Runner struct {
UseRace bool // Enable race detector.
FailFast bool // Stop on first test failure.
SkipTests []string // Test names to exclude.
RunAllTestPackages bool // Run all test packages if true.
SelectedTestPackages []string // Explicitly selected packages to run.
}

// RunTests executes the tests for each provided package and aggregates all results.
// It returns all test results and any error encountered during testing.
func (r *Runner) RunTests() ([]reports.TestResult, error) {
var jsonFilePaths []string
packages := r.SelectedTestPackages
if r.RunAllTestPackages {
packages = []string{"./..."}
}

for _, p := range packages {
for _, p := range r.SelectedTestPackages {
for i := 0; i < r.RunCount; i++ {
jsonFilePath, passed, err := r.runTests(p)
if err != nil {
Expand Down

0 comments on commit d5a4c34

Please sign in to comment.