Skip to content

test(app): wait for the slow commands of two E2E tests - #10

Closed
Thelost77 wants to merge 1 commit into
mainfrom
fix/windows-test-flake
Closed

Thelost77 wants to merge 1 commit into
mainfrom
fix/windows-test-flake

Conversation

@Thelost77

@Thelost77 Thelost77 commented Oct 13, 2026 •

Copy link
Copy Markdown
Owner

What was wrong

Two tests of internal/app failed at times on Windows in CI, and passed in the next run of the same commit:

  • TestE2E_LoginFailure: expected login error after failed attempt
  • TestE2E_CacheSurvivesRestart: home should not be loading after first init

In the seven CI runs of the pull requests #8 and #9 and of their merges, the Windows job failed on the first attempt in four runs (0ea2185, 7f54726, 1588e30, 730bab6).

The helper feedCmd runs a command and gives its message to Update. It skips a command that needs more than 200 ms, so that a test does not wait for a tea.Tick. Each of the two tests needs the result of a command that can need more than 200 ms:

  • TestE2E_LoginFailure waits for a refused connection to 127.0.0.1:1.
  • TestE2E_CacheSurvivesRestart is the only E2E test that runs Init with a real cache store. The load of the home screen sends its requests and writes to the SQLite file in one command.

feedCmd then skipped the command, and the model did not get the message.

What changes

  • feedCmdWithin is feedCmd with a wait of its own. feedCmd calls it with the 200 ms of before, so each other test is as it was.
  • The two tests use feedCmdWithin with slowCmdWait (15 seconds) for the command that they need. 15 seconds is longer than the timeout of one request of abs.Client (10 seconds).
  • AGENTS.md has the rule for new tests.

No code of pine or spruce changes.

How it was tested

The failures do not occur on Linux. A copy of the repository got two delays, which are not in this pull request:

  • The fake server waits 120 ms before each answer.
  • TestE2E_LoginFailure uses a listener that closes each connection after 400 ms, with no answer.
Code Result with the two delays
main (b89f0fb) e2e_test.go:126: expected login error after failed attempt and e2e_test.go:2284: home should not be loading after first init, the messages of the Windows job
This pull request The two tests pass, also in 20 runs with -count=20

Checks on Linux, on the commit of this pull request, in a clean copy of the commit:

  • gofmt -l .: no file
  • go vet ./...: pass
  • golangci-lint run with version 2.14.0: 0 issues
  • PINE_REQUIRE_LIBMPV=1 PINE_REQUIRE_DBUS=1 go test ./... -count=1: 855 tests pass
  • go test -race ./internal/app/ -count=1: pass

Not tested

  • No test ran on a Windows machine before CI. The cause is an inference from the test durations in CI (0.22 seconds for TestE2E_LoginFailure), from the code of feedCmd, and from the reproduction with the delays.

Not changed

  • Each other test uses feedCmd with 200 ms. A work command of a different test that needs more than 200 ms is skipped as before. No other test failed in those seven CI runs.
  • TestE2E_CacheSurvivesRestart now waits for the 500 ms tea.Tick of the home screen in each of its two Init calls, because that tick is shorter than the wait. The test needs about 1 second.

🤖 Generated with Claude Code

- feedCmd skips a command that needs more than 200 ms, so that a test
  does not wait for a tea.Tick. Two tests need a command that can need
  more on Windows in CI. TestE2E_LoginFailure waits for a refused
  connection. TestE2E_CacheSurvivesRestart waits for the load of the
  home screen, which sends its requests and writes to the database file
  in one command. The two tests failed at times on Windows, and passed
  in the next run of the same commit.
- feedCmdWithin is feedCmd with a wait of its own. The two tests use it
  with slowCmdWait (15 seconds) for these commands. feedCmd is as it
  was for each other test.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Thelost77

Copy link
Copy Markdown
Owner Author

Closed with no merge. The commit goes to main directly.

@Thelost77 Thelost77 closed this Oct 13, 2026
@Thelost77
Thelost77 deleted the fix/windows-test-flake branch October 13, 2026 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant