Skip to content

[CP-952] Run the test suite on GitHub Actions; fix three stale or racy tests - #18

Open
TC-jCruz wants to merge 3 commits into
xmpp_onlyfrom
jcruz/CP-952
Open

TC-jCruz wants to merge 3 commits into
xmpp_onlyfrom
jcruz/CP-952

Conversation

@TC-jCruz

@TC-jCruz TC-jCruz commented Nov 21, 2026 •

Copy link
Copy Markdown

What

  • .github/workflows/ci.yml: runs rebar3 eunit on OTP 22.3 (the same build xmpp uses) against a Redis 7 service, on every pull request and on pushes to xmpp_only. Actions and images are pinned by SHA/digest; contents: read; 15 min timeout.
  • Three test-only fixes so the suite is green on today's xmpp_only.

Why

Travis has errored at setup on every build since at least 2025-08 (it can no longer download OTP 21.0.1, the first of 24 OTP versions in .travis.yml), so no test has run in CI for over a year. This library runs on every xmpp task.

Test fixes

Test Cause Fix
connection_failure_during_start_reconnect_test start_link/5 connects synchronously since 49c714f (2019); the test expects the async start. Its failure left trap_exit on and broke 5 eredis_sub_tests. Call start_link/9 with SyncStart = false
crash_queue_test The client sends {exited, N} before exiting since 9427287 (2024). Leftover messages broke the next 2 tests. Expect {exited, _}, then 'DOWN'
tcp_closed_test / tcp_closed_no_reconnect_test Race: a query that reaches the client after the fake close gets no_connection. Failed 1 in 10 local runs. Accept tcp_closed or no_connection

Results

  • Before: 63 tests, 9 failures on xmpp_only.
  • After, locally with erlang:22 + redis:7: 63 tests, 0 failures in 40 of 40 runs.
  • One earlier local run (before the race fix) ended with 6 tests cancelled and wasn't captured; it didn't come back in 40 runs. If CI shows it, that log is what to look at.

Not in this PR

  • The check is not required on xmpp_only; branch protection is unchanged.
  • .travis.yml is left as is, so the Travis checks stay red.

Related Tickets

🤖 Generated with Claude Code

TC-jCruz and others added 3 commits November 20, 2026 18:17
…y tests

Travis has errored at setup on every build since at least 2025-08
(it can no longer download OTP 21.0.1), so no test has run in CI.
The new workflow runs rebar3 eunit on OTP 22.3 (xmpp's version)
against a Redis 7 service, on pull requests and pushes to xmpp_only.
It is not a required check, and .travis.yml is left as is.

Test fixes, all test-only:
- connection_failure_during_start_reconnect_test: start_link/5 connects
  synchronously since 49c714f; use start_link/9 with SyncStart=false.
  Its failure left trap_exit on and broke 5 eredis_sub_tests.
- crash_queue_test: expect {exited, N} before 'DOWN' (sent since 9427287).
  Its leftover messages broke the next 2 tests.
- tcp_closed_rig: a query that reaches the client after the close gets
  no_connection; accept it (failed 1 in 10 runs locally).

Locally (erlang:22 + redis:7): 63 tests, 0 failures, 40 of 40 runs.

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
@TC-jCruz
TC-jCruz marked this pull request as ready for review November 21, 2026 00:34
@TC-jCruz
TC-jCruz requested a balanced review from Copilot November 21, 2026 00:34

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The test still has a race where an early fake TCP close terminates the client before a query, leaving a worker unable to report its result and causing the test to time out.

1 open issue
What changed in this PR

This PR restores automated testing for the eredis fork used by xmpp, adding GitHub Actions coverage and updating stale or racy tests.

Changes:

  • Run EUnit with OTP 22 and Redis 7 on pull requests and pushes to xmpp_only.
  • Pin CI dependencies and limit workflow permissions and runtime.
  • Update tests for asynchronous startup, subscriber exit notifications, and connection-close errors.
File Description
test/​eredis_tests.erl Request asynchronous startup explicitly and broaden accepted connection-close errors.
test/​eredis_sub_tests.erl Expect the subscriber’s exit notification before its monitor notification.
.github/​workflows/​ci.yml Add the pinned OTP/Redis EUnit workflow.

Review effort: Balanced

Comment thread test/eredis_tests.erl
Comment on lines +206 to +207
?assertMatch({error, E} when E =:= tcp_closed; E =:= no_connection,
proplists:get_value(1, Results)),
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.

2 participants