ci(linux): bring up redis-server and mysql-server for unittests#3323
ci(linux): bring up redis-server and mysql-server for unittests#3323rajvarun77 wants to merge 4 commits into
Conversation
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>
The failing
|
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>
|
CI is green on the latest commit. Full Build and Test on Linux run passes — all jobs, including Ready for review. |
There was a problem hiding this comment.
Pull request overview
Updates the Linux GitHub Actions unittest jobs to ensure Redis/MySQL-dependent tests are exercised in CI (instead of being skipped when servers/binaries are missing).
Changes:
- Install
redis-server(and currentlymysql-server) in theclang-unittestjob before runningtest/run_tests.sh. - Do the same for
clang-unittest-asan, and additionally apply aGTEST_FILTERto avoid Redis-related ASan flakiness.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - name: install redis-server and mysql-server | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y redis-server mysql-server | ||
| redis-server --version | ||
| mysqld --version |
There was a problem hiding this comment.
Expected. mysql-server is installed intentionally ahead of the in-progress MySQL protocol support (#2093); the client tests for it land in a follow-up, and pre-provisioning the server here avoids a second CI change when they do. The extra install time is small and the step is green in every job.
| - name: install redis-server and mysql-server | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y redis-server mysql-server | ||
| redis-server --version | ||
| mysqld --version |
There was a problem hiding this comment.
Same as the clang-unittest job above — mysql-server is pre-installed intentionally for the upcoming MySQL protocol tests (#2093). Expected, not extraneous.
| # brpc_redis_unittest forks a real redis-server and waits a fixed 50ms before | ||
| # connecting; under ASan redis starts too slowly, so the redis client tests are | ||
| # flaky here (connection refused). Skip them in ASan; they run in clang-unittest. | ||
| GTEST_FILTER='-RedisTest.*' sh ./run_tests.sh |
There was a problem hiding this comment.
Applied. The ASan filter now excludes only the five client tests that connect to the forked redis-server — RedisTest.sanity, keys_with_spaces, incr_and_decr, by_components, auth. The pure parsing/service cases (command_parser, redis_reply_codec, memory_allocation_limits, server_*) still run under ASan, so coverage of that logic is preserved.
| cat config.mk | ||
| cd test | ||
| make -j ${{env.proc_num}} | ||
| - name: install redis-server and mysql-server |
There was a problem hiding this comment.
You can refer to install-essential-dependencies and add an action to install the Redis server and MySQL server.
There was a problem hiding this comment.
Done — moved the redis-server / mysql-server install into the install-essential-dependencies composite action and removed the per-job install steps from clang-unittest and clang-unittest-asan. Every job that pulls in those dependencies now brings up both servers. Re-validated on my fork: all Linux jobs green (https://github.com/rajvarun77/brpc/actions/runs/26858989158).
| # flaky here (connection refused). Skip them in ASan; they run in clang-unittest. | ||
| GTEST_FILTER='-RedisTest.*' sh ./run_tests.sh | ||
|
|
||
| clang-unittest-bazel-with-babylon-and-new-pb: |
There was a problem hiding this comment.
Do clang-unittest-bazel-with-babylon-and-new-pb, clang-unittest-with-bazel and gcc-unittest-with-bazel also require Redis server to be installed?
There was a problem hiding this comment.
Good question. gcc-unittest-with-bazel, clang-unittest-with-bazel and clang-unittest-bazel-with-babylon-and-new-pb don't use the install-essential-dependencies action, so this change doesn't install Redis/MySQL in them. The Redis client tests there continue to self-skip when redis-server is absent — the same behaviour as before this PR. If you'd like those bazel jobs to exercise the live-server tests as well, I'm happy to add it in a follow-up.
…-dependencies Move the redis-server/mysql-server install out of the individual clang-unittest and clang-unittest-asan jobs and into the shared install-essential-dependencies composite action, so every job that installs dependencies has the servers available (and the unittest jobs no longer carry a bespoke install step). Under ASan the redis integration tests (sanity, keys_with_spaces, incr_and_decr, by_components, auth) fork a real redis-server and connect after a fixed 50ms wait; redis starts too slowly there and they flake with connection refused. Filter just those out under ASan -- the redis codec/server tests still run, and the full suite runs in clang-unittest. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Addressed the review feedback:
Re-validated end-to-end on my fork — all Linux jobs green, including |
Log verification: Redis integration tests run in
|
The bazel unittest jobs ran //test/... without redis-server/mysql-server installed, so brpc_redis_unittest forked nothing and its integration cases (sanity/keys_with_spaces/incr_and_decr/by_components/auth) early-returned as passes -- green but vacuous. - Install redis-server/mysql-server in the (non-ASan) bazel test jobs via the shared install-essential-dependencies action (the same one the make jobs use), so the servers are on PATH for the forked tests. - Tag brpc_redis_unittest "external" + "local" so bazel always re-runs it (never serves a cached skip) and runs it outside the sandbox where the PATH-located redis-server is visible and loopback works. Threaded through generate_unittests via a new per_test_tags arg. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>



Bring up redis-server + mysql-server in the Linux unittest jobs so the redis/mysql client tests actually run instead of being skipped when the servers are absent.
CI exercised on my fork (these tests run there): rajvarun77#1.