1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-04-19 12:12:42 +02:00

allow two attempts on CI

This commit is contained in:
Jesse Duffield 2022-09-16 22:31:46 -07:00
parent 850a82784a
commit 6dca3e1766
4 changed files with 19 additions and 1 deletions

View File

@ -43,6 +43,7 @@ func RunCLI(testNames []string, slow bool, sandbox bool) {
runAndPrintFatalError,
mode,
keyPressDelay,
1,
)
if err != nil {
log.Print(err.Error())

View File

@ -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)

View File

@ -375,6 +375,7 @@ func runTuiTest(test *components.IntegrationTest, mode components.Mode, keyPress
runAndPrintError,
mode,
keyPressDelay,
1,
)
if err != nil {
log.Println(err.Error())

View File

@ -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
})
}