diff --git a/pkg/integration/clients/cli.go b/pkg/integration/clients/cli.go index 0222bd129..73a02c432 100644 --- a/pkg/integration/clients/cli.go +++ b/pkg/integration/clients/cli.go @@ -43,6 +43,7 @@ func RunCLI(testNames []string, slow bool, sandbox bool) { runAndPrintFatalError, mode, keyPressDelay, + 1, ) if err != nil { log.Print(err.Error()) diff --git a/pkg/integration/clients/go_test.go b/pkg/integration/clients/go_test.go index a14b1f254..3e442feaf 100644 --- a/pkg/integration/clients/go_test.go +++ b/pkg/integration/clients/go_test.go @@ -48,6 +48,9 @@ func TestIntegration(t *testing.T) { }, components.CHECK_SNAPSHOT, 0, + // allowing two attempts at the test. If a test fails intermittently, + // there may be a concurrency issue that we need to resolve. + 2, ) assert.NoError(t, err) diff --git a/pkg/integration/clients/tui.go b/pkg/integration/clients/tui.go index 96ffed8b0..656d16877 100644 --- a/pkg/integration/clients/tui.go +++ b/pkg/integration/clients/tui.go @@ -375,6 +375,7 @@ func runTuiTest(test *components.IntegrationTest, mode components.Mode, keyPress runAndPrintError, mode, keyPressDelay, + 1, ) if err != nil { log.Println(err.Error()) diff --git a/pkg/integration/components/runner.go b/pkg/integration/components/runner.go index 54b42de17..26ac57875 100644 --- a/pkg/integration/components/runner.go +++ b/pkg/integration/components/runner.go @@ -42,6 +42,7 @@ func RunTests( testWrapper func(test *IntegrationTest, f func() error), mode Mode, keyPressDelay int, + maxAttempts int, ) error { projectRootDir := utils.GetLazygitRootDirectory() err := os.Chdir(projectRootDir) @@ -63,7 +64,19 @@ func RunTests( filepath.Join(testDir, test.Name()), ) - return runTest(test, paths, projectRootDir, logf, runCmd, mode, keyPressDelay) + for i := 0; i < maxAttempts; i++ { + err := runTest(test, paths, projectRootDir, logf, runCmd, mode, keyPressDelay) + if err != nil { + if i == maxAttempts-1 { + return err + } + logf("retrying test %s", test.Name()) + } else { + break + } + } + + return nil }) }