1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-08-06 22:33:07 +02:00

Fix more unstable tests

Similar to what was done in 457cdce61d, and for the same reason.

However, instead of waiting and fixing them one by one as we see them fail, I
decided to go about it more systematically. To do that, I added calls to
`time.Sleep(1 * time.Second)` in all the Shell.Commit* helper functions; this
ensures that all the commits we make get different committer time stamps, making
all these tests fail. With this I'm pretty confident that we're good now.
This commit is contained in:
Stefan Haller
2025-07-10 08:55:11 +02:00
parent 656cb3203c
commit bf19475733
7 changed files with 13 additions and 2 deletions

View File

@ -9,7 +9,9 @@ var Checkout = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Checkout a commit as a detached head, or checkout an existing branch at a commit", Description: "Checkout a commit as a detached head, or checkout an existing branch at a commit",
ExtraCmdArgs: []string{}, ExtraCmdArgs: []string{},
Skip: false, Skip: false,
SetupConfig: func(config *config.AppConfig) {}, SetupConfig: func(config *config.AppConfig) {
config.GetUserConfig().Git.LocalBranchSortOrder = "alphabetical"
},
SetupRepo: func(shell *Shell) { SetupRepo: func(shell *Shell) {
shell.EmptyCommit("one") shell.EmptyCommit("one")
shell.EmptyCommit("two") shell.EmptyCommit("two")

View File

@ -37,6 +37,8 @@ var SuggestionsCommand = NewIntegrationTest(NewIntegrationTestArgs{
}, },
}, },
} }
cfg.GetUserConfig().Git.LocalBranchSortOrder = "alphabetical"
}, },
Run: func(t *TestDriver, keys config.KeybindingConfig) { Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Branches(). t.Views().Branches().

View File

@ -37,6 +37,8 @@ var SuggestionsPreset = NewIntegrationTest(NewIntegrationTestArgs{
}, },
}, },
} }
cfg.GetUserConfig().Git.LocalBranchSortOrder = "alphabetical"
}, },
Run: func(t *TestDriver, keys config.KeybindingConfig) { Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Branches(). t.Views().Branches().

View File

@ -9,7 +9,9 @@ var NestedFilter = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Filter in the several nested panels and verify the filters are preserved as you escape back to the surface", Description: "Filter in the several nested panels and verify the filters are preserved as you escape back to the surface",
ExtraCmdArgs: []string{}, ExtraCmdArgs: []string{},
Skip: false, Skip: false,
SetupConfig: func(config *config.AppConfig) {}, SetupConfig: func(config *config.AppConfig) {
config.GetUserConfig().Git.LocalBranchSortOrder = "alphabetical"
},
SetupRepo: func(shell *Shell) { SetupRepo: func(shell *Shell) {
// need to create some branches, each with their own commits // need to create some branches, each with their own commits
shell.NewBranch("branch-gold") shell.NewBranch("branch-gold")

View File

@ -11,6 +11,7 @@ var FetchAndAutoForwardBranchesAllBranches = NewIntegrationTest(NewIntegrationTe
Skip: false, Skip: false,
SetupConfig: func(config *config.AppConfig) { SetupConfig: func(config *config.AppConfig) {
config.GetUserConfig().Git.AutoForwardBranches = "allBranches" config.GetUserConfig().Git.AutoForwardBranches = "allBranches"
config.GetUserConfig().Git.LocalBranchSortOrder = "alphabetical"
}, },
SetupRepo: func(shell *Shell) { SetupRepo: func(shell *Shell) {
shell.CreateNCommits(3) shell.CreateNCommits(3)

View File

@ -11,6 +11,7 @@ var FetchAndAutoForwardBranchesNone = NewIntegrationTest(NewIntegrationTestArgs{
Skip: false, Skip: false,
SetupConfig: func(config *config.AppConfig) { SetupConfig: func(config *config.AppConfig) {
config.GetUserConfig().Git.AutoForwardBranches = "none" config.GetUserConfig().Git.AutoForwardBranches = "none"
config.GetUserConfig().Git.LocalBranchSortOrder = "alphabetical"
}, },
SetupRepo: func(shell *Shell) { SetupRepo: func(shell *Shell) {
shell.CreateNCommits(3) shell.CreateNCommits(3)

View File

@ -11,6 +11,7 @@ var FetchAndAutoForwardBranchesOnlyMainBranches = NewIntegrationTest(NewIntegrat
Skip: false, Skip: false,
SetupConfig: func(config *config.AppConfig) { SetupConfig: func(config *config.AppConfig) {
config.GetUserConfig().Git.AutoForwardBranches = "onlyMainBranches" config.GetUserConfig().Git.AutoForwardBranches = "onlyMainBranches"
config.GetUserConfig().Git.LocalBranchSortOrder = "alphabetical"
}, },
SetupRepo: func(shell *Shell) { SetupRepo: func(shell *Shell) {
shell.CreateNCommits(3) shell.CreateNCommits(3)