summaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2023-07-08 15:23:58 +1000
committerJesse Duffield <jessedduffield@gmail.com>2023-07-09 20:57:18 +1000
commitc7a3b69eb92dd5b543769cafcb2992da1ee8ed4d (patch)
treee4b00fea75a56244b18d9b426620ffb4b36cc4f0 /pkg
parentb19943af01c4f3f1bc7d358194e4c5b99f5b997b (diff)
Remove retry logic in integration tests
I want to see how we go removing all retry logic within a test. Lazygit should be trusted to tell us when it's no longer busy, and if it that proves false we should fix the issue in the code rather than being lenient in the tests
Diffstat (limited to 'pkg')
-rw-r--r--pkg/integration/components/assertion_helper.go32
1 files changed, 5 insertions, 27 deletions
diff --git a/pkg/integration/components/assertion_helper.go b/pkg/integration/components/assertion_helper.go
index f7e435a1f..0529e8bec 100644
--- a/pkg/integration/components/assertion_helper.go
+++ b/pkg/integration/components/assertion_helper.go
@@ -1,9 +1,6 @@
package components
import (
- "os"
- "time"
-
integrationTypes "github.com/jesseduffield/lazygit/pkg/integration/types"
)
@@ -11,19 +8,6 @@ type assertionHelper struct {
gui integrationTypes.GuiDriver
}
-// milliseconds we'll wait when an assertion fails.
-func retryWaitTimes() []int {
- return []int{0}
-
- if os.Getenv("LONG_WAIT_BEFORE_FAIL") == "true" {
- // CI has limited hardware, may be throttled, runs tests in parallel, etc, so we
- // give it more leeway compared to when we're running things locally.
- return []int{0, 1, 1, 1, 1, 1, 5, 10, 20, 40, 100, 200, 500, 1000, 2000, 4000}
- } else {
- return []int{0, 1, 1, 1, 1, 1, 5, 10, 20, 40, 100, 200}
- }
-}
-
func (self *assertionHelper) matchString(matcher *TextMatcher, context string, getValue func() string) {
self.assertWithRetries(func() (bool, string) {
value := getValue()
@@ -31,19 +15,13 @@ func (self *assertionHelper) matchString(matcher *TextMatcher, context string, g
})
}
+// We no longer assert with retries now that lazygit tells us when it's no longer
+// busy. But I'm keeping the function in case we want to re-introduce it later.
func (self *assertionHelper) assertWithRetries(test func() (bool, string)) {
- var message string
- for _, waitTime := range retryWaitTimes() {
- time.Sleep(time.Duration(waitTime) * time.Millisecond)
-
- var ok bool
- ok, message = test()
- if ok {
- return
- }
+ ok, message := test()
+ if !ok {
+ self.fail(message)
}
-
- self.fail(message)
}
func (self *assertionHelper) fail(message string) {