Skip to content

ci(linux): bring up redis-server and mysql-server for unittests#1

Open
rajvarun77 wants to merge 2 commits into
masterfrom
ci-install-redis-mysql
Open

ci(linux): bring up redis-server and mysql-server for unittests#1
rajvarun77 wants to merge 2 commits into
masterfrom
ci-install-redis-mysql

Conversation

@rajvarun77
Copy link
Copy Markdown
Owner

What

Install redis-server and mysql-server in the clang-unittest and
clang-unittest-asan jobs (Linux), right before run_tests.sh, so the backend
integration tests in the unit-test suite execute against a live server instead
of silently no-op'ing.

Why

test/run_tests.sh runs brpc_redis_unittest, which forks a real
redis-server when the binary is found and otherwise short-circuits each
redis-dependent case with a bare return. gtest counts that return as
PASS, not SKIP. Because CI never installed redis-server, 7 of the 14
RedisTest cases (sanity, keys_with_spaces, incr_and_decr,
by_components, auth, cmd_format, quote_and_escape) reported [ OK ]
while doing nothing — a long-standing false green. The remaining 7 cases are
true in-process unit tests and are unaffected.

Installing the server binary lets these cases run for real. mysql-server is
added alongside redis to bring the same live-backend coverage to the in-flight
MySQL backend work (apache#2093 / apache#3310).

Scope

  • Binaries are installed only in the two unittest jobs, not in the shared
    install-essential-dependencies action (which feeds compile-only jobs that
    must stay lean).
  • test/run_tests.sh is unchanged — it already builds and runs brpc_*unittest.
  • No test source changes in this PR; this is the CI-install half. A follow-up can
    convert the silent return skips to honest GTEST_SKIP() and add a
    require-backend flag so a missing server hard-fails CI instead of skipping.

Test plan

  • Validated on a fork run with Actions enabled: redis-server + mysql-server
    install, then run_tests.sh exercises the redis backend tests against the live
    server.

The clang-unittest and clang-unittest-asan jobs run the full unit test
suite via test/run_tests.sh, which includes backend integration tests
(e.g. brpc_redis_unittest) that fork a real server when its binary is
present and otherwise silently short-circuit to a passing result. Since
CI never installed those servers, the redis backend tests reported
PASSED while doing nothing (7 of 14 RedisTest cases skip-as-pass).

Install redis-server and mysql-server before running the tests in both
unittest jobs so these backend tests execute against a live server. The
binaries are added only in the unittest jobs, not in the shared
install-essential-dependencies action used by compile-only jobs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@rajvarun77
Copy link
Copy Markdown
Owner Author

The failing clang-unittest-asan job is a pre-existing test race — not caused by this change

This PR only installs redis-server + mysql-server. That install step passes in every job it was added to (clang-unittest ✅, clang-unittest-asan ✅). The single red job fails inside brpc_redis_unittest, on the 5 tests that talk to a redis the test itself forks on port 6479:

brpc_redis_unittest.cpp:173: Failure
Value of: cntl.Failed()   Actual: true   Expected: false
[E111]Fail to connect ...addr=0.0.0.0:6479...: Connection refused
[  FAILED  ] RedisTest.sanity / keys_with_spaces / incr_and_decr / by_components / auth

Why: RunRedisServer() in test/brpc_redis_unittest.cpp forks redis-server --port 6479 and then waits a fixed usleep(50000) (50 ms) before the first client test connects. On the ASAN runner redis only becomes ready ~82 ms after the fork (same job log: fork ≈ 21:00:06.93Ready to accept connections 21:00:07.013), so the first 5 client tests hit Connection refused.

Before this change, which redis-server failed, so those 5 tests were skipped (auto-green). Installing redis simply un-skipped them and exposed the latent 50 ms startup race. The race lives in test/brpc_redis_unittest.cpp, independent of this workflow change.

evidence: PR asan failure is a pre-existing redis test race

brpc_redis_unittest forks a real redis-server and waits a fixed 50ms before
connecting; under ASan redis starts too slowly, causing flaky connection-refused.
Skip RedisTest.* in the ASan job only (still covered by clang-unittest).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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