jesseduffield / jesseduffield/lazygit
Tasks Test Flaky
- Dominant language
- Go
- Stars
- 82.4k
- Forks
- 3k
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 19
Description
**Describe the bug**
Intermittently, when running `go test ./... -short` on my machine I get the following error:
```
setting to 2
--- FAIL: TestNewCmdTask (0.28s)
tasks_test.go:143: expected beforeStart to be called 1 times, got 0
tasks_test.go:143: expected onEndOfInput to be called 1 times, got 0
tasks_test.go:154: expected writer to receive the following content:
prefix
test
. But instead it received:
--- FAIL: TestNewCmdTaskRefresh (1.70s)
tasks_test.go:266: total < initialRefreshAfter: expected line counts on refresh: [100], got [0]
tasks_test.go:266: total == initialRefreshAfter: expected line counts on refresh: [100], got [0]
tasks_test.go:266: total > initialRefreshAfter: expected line counts on refresh: [50 100], got [0]
tasks_test.go:266: initialRefreshAfter == -1: expected line counts on refresh: [100], got [0]
tasks_test.go:266: totalTaskLines < initialRefreshAfter: expected line counts on refresh: [25], got [0]
tasks_test.go:266: totalTaskLines between total and initialRefreshAfter: expected line counts on refresh: [50 75], got [0]
FAIL
FAIL github.com/jesseduffield/lazygit/pkg/tasks 2.916s
```
**To Reproduce**
1. Run `go test ./... -short`
2. Get unlucky (Can't reproduce consistently)
3. See error
**Expected behavior**
I expect the tests to pass consistently on my local machine, like they seem to do in pipelines
**Screenshots**
N/A
**Version info:**
Building locally on `1e05055ff`
git version 2.25.1
**Additional context**
Didn't happen when I tried reproducing while writing this bug report. Logs taken from earlier today. I also went all the back to last July and it still failed on a detached head there. So not related to recent changes.
I'm running the tests inside of Ubuntu WSL2 `Kernel version: 5.10.102.1` on Windows 10, on `go version go1.23.6 linux/amd64`.
I'll be poking around this a bit more, but given that my tests started passing when I try to reproduce now... Might just be left open for the next person who searches this error.
Contributor guide
Assessment
This issue has not been assessed yet.