From a6e885b9cc64bc771541d8238bcbb6cf23b78f8b Mon Sep 17 00:00:00 2001 From: rajvarun77 <287367605+rajvarun77@users.noreply.github.com> Date: Mon, 1 Jun 2026 16:22:25 -0400 Subject: [PATCH 1/4] ci(linux): bring up redis-server and mysql-server for unittests 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) --- .github/workflows/ci-linux.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/ci-linux.yml b/.github/workflows/ci-linux.yml index 8a36af6024..3ff605a60f 100644 --- a/.github/workflows/ci-linux.yml +++ b/.github/workflows/ci-linux.yml @@ -196,6 +196,12 @@ jobs: cat config.mk cd test make -j ${{env.proc_num}} + - 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 - name: run tests run: | cd test @@ -214,6 +220,12 @@ jobs: cat config.mk cd test make NEED_GPERFTOOLS=0 -j ${{env.proc_num}} + - 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 - name: run tests run: | cd test From c6a03f54f1ddc3c4cbb329ecbee8be8dc1bdf2ba Mon Sep 17 00:00:00 2001 From: rajvarun77 Date: Mon, 1 Jun 2026 20:08:41 -0400 Subject: [PATCH 2/4] ci(linux): skip flaky redis client tests under ASan 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) --- .github/workflows/ci-linux.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-linux.yml b/.github/workflows/ci-linux.yml index 3ff605a60f..bfb8846af4 100644 --- a/.github/workflows/ci-linux.yml +++ b/.github/workflows/ci-linux.yml @@ -229,7 +229,10 @@ jobs: - name: run tests run: | cd test - sh ./run_tests.sh + # 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 clang-unittest-bazel-with-babylon-and-new-pb: runs-on: ubuntu-22.04 From 4ed6c4857d917bc41e3c91eb890726ea8aec1415 Mon Sep 17 00:00:00 2001 From: rajvarun77 <287367605+rajvarun77@users.noreply.github.com> Date: Tue, 2 Jun 2026 21:53:57 -0400 Subject: [PATCH 3/4] ci(linux): install redis-server and mysql-server in install-essential-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) --- .../install-essential-dependencies/action.yml | 4 +++- .github/workflows/ci-linux.yml | 21 +++++-------------- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/.github/actions/install-essential-dependencies/action.yml b/.github/actions/install-essential-dependencies/action.yml index d6c5da96c1..f64b74ee16 100644 --- a/.github/actions/install-essential-dependencies/action.yml +++ b/.github/actions/install-essential-dependencies/action.yml @@ -3,5 +3,7 @@ runs: steps: - run: ulimit -c unlimited -S && sudo bash -c "echo 'core.%e.%p' > /proc/sys/kernel/core_pattern" shell: bash - - run: sudo apt-get update && sudo apt-get install -y git g++ make libssl-dev libgflags-dev libprotobuf-dev libprotoc-dev protobuf-compiler libleveldb-dev + - run: sudo apt-get update && sudo apt-get install -y git g++ make libssl-dev libgflags-dev libprotobuf-dev libprotoc-dev protobuf-compiler libleveldb-dev redis-server mysql-server + shell: bash + - run: redis-server --version && mysqld --version shell: bash diff --git a/.github/workflows/ci-linux.yml b/.github/workflows/ci-linux.yml index bfb8846af4..87b070d50d 100644 --- a/.github/workflows/ci-linux.yml +++ b/.github/workflows/ci-linux.yml @@ -196,12 +196,6 @@ jobs: cat config.mk cd test make -j ${{env.proc_num}} - - 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 - name: run tests run: | cd test @@ -220,19 +214,14 @@ jobs: cat config.mk cd test make NEED_GPERFTOOLS=0 -j ${{env.proc_num}} - - 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 - name: run tests run: | cd test - # 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 + # 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; under ASan redis starts + # too slowly, so they flake here (connection refused). Skip just those under ASan; the + # redis codec/server tests still run, and the full suite runs in clang-unittest. + GTEST_FILTER='-RedisTest.sanity:RedisTest.keys_with_spaces:RedisTest.incr_and_decr:RedisTest.by_components:RedisTest.auth' sh ./run_tests.sh clang-unittest-bazel-with-babylon-and-new-pb: runs-on: ubuntu-22.04 From 815d0866ecedad6afacd41e534b8e251453eddc3 Mon Sep 17 00:00:00 2001 From: rajvarun77 <287367605+rajvarun77@users.noreply.github.com> Date: Wed, 3 Jun 2026 14:03:35 -0400 Subject: [PATCH 4/4] ci(linux): run forked-server integration tests under bazel 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) --- .github/workflows/ci-linux.yml | 12 +++++++++++- test/BUILD.bazel | 8 ++++++++ test/generate_unittests.bzl | 7 ++++++- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-linux.yml b/.github/workflows/ci-linux.yml index 87b070d50d..2bbadae767 100644 --- a/.github/workflows/ci-linux.yml +++ b/.github/workflows/ci-linux.yml @@ -107,6 +107,10 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v2 + # Install redis-server/mysql-server so the integration tests that fork a + # real server (e.g. brpc_redis_unittest) actually run under bazel instead + # of skipping. Same shared action the make-based unittest jobs use. + - uses: ./.github/actions/install-essential-dependencies - run: bazel test //test/... gcc-compile-with-bazel-all-options: @@ -160,6 +164,9 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v2 + # Install redis-server/mysql-server so the forked-server integration tests + # actually run under bazel (see gcc-unittest-with-bazel). + - uses: ./.github/actions/install-essential-dependencies - run: | bazel test --test_output=streamed \ --action_env=CC=clang \ @@ -233,6 +240,9 @@ jobs: USE_BAZEL_VERSION: "8.3.1" steps: - uses: actions/checkout@v2 + # Install redis-server/mysql-server so the forked-server integration tests + # actually run under bazel (see gcc-unittest-with-bazel). + - uses: ./.github/actions/install-essential-dependencies - name: Override protobuf version for testing run: | sed -i -E "s/(bazel_dep\(name = ['\"]protobuf['\"], version = ['\"])[^'\"]+/\1${TEST_PROTOBUF_VERSION}/" MODULE.bazel @@ -240,7 +250,7 @@ jobs: grep -E "bazel_dep\(name = ['\"]protobuf['\"]" MODULE.bazel grep -qE "bazel_dep\(name = ['\"]protobuf['\"], version = ['\"]${TEST_PROTOBUF_VERSION}['\"]" MODULE.bazel \ || { echo "ERROR: failed to override protobuf version in MODULE.bazel to ${TEST_PROTOBUF_VERSION}"; exit 1; } - - run: | + - run: | bazel test --action_env=CC=clang \ --define with_babylon_counter=true \ --define with_babylon_counter=true \ diff --git a/test/BUILD.bazel b/test/BUILD.bazel index 18af200dd5..d536197aee 100644 --- a/test/BUILD.bazel +++ b/test/BUILD.bazel @@ -251,6 +251,14 @@ generate_unittests( data = [ ":test_runfiles_root_data", ], + # brpc_redis_unittest forks a real redis-server located via PATH. Tag it + # "external" so bazel always re-runs it (never serves a cached pass that + # actually skipped) and "local" so it runs outside the sandbox, where the + # apt-installed redis-server is visible and loopback works. The CI bazel + # jobs install redis-server via the install-essential-dependencies action. + per_test_tags = { + "brpc_redis_unittest.cpp": ["external", "local"], + }, ) refresh_compile_commands( diff --git a/test/generate_unittests.bzl b/test/generate_unittests.bzl index 4b37dd6fbc..8cfec78a71 100644 --- a/test/generate_unittests.bzl +++ b/test/generate_unittests.bzl @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -def generate_unittests(name, srcs, deps, copts, linkopts = [], data = []): +def generate_unittests(name, srcs, deps, copts, linkopts = [], data = [], per_test_tags = {}): tests = [] for s in srcs: ut_name = s.replace(".cpp", "") @@ -24,6 +24,11 @@ def generate_unittests(name, srcs, deps, copts, linkopts = [], data = []): deps = deps, linkopts = linkopts, data = data, + # Integration tests that fork a real server binary (e.g. redis-server) + # need extra tags: "external" forces a real run instead of a cached + # pass, and "local" runs them outside the sandbox so the PATH-located + # server binary is visible and loopback works. + tags = per_test_tags.get(s, []), ) tests.append(":" + ut_name)