Skip to content

ci: run the Redis Cluster tests nightly - #796

Draft
vishal-bala wants to merge 4 commits into
fix/cluster-aclear-test-seed-with-amsetfrom
ci/nightly-cluster-tests
Draft

vishal-bala wants to merge 4 commits into
fix/cluster-aclear-test-seed-with-amsetfrom
ci/nightly-cluster-tests

Conversation

@vishal-bala

@vishal-bala vishal-bala commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation

No CI job passes --run-cluster-tests, so every test marked requires_cluster has been skipped on every run. Cluster-only regressions, and cluster tests that no longer test what they claim, have gone unnoticed as a result. This PR runs that suite nightly so the cluster code path gets regular coverage without slowing down pull requests.

Changes

Nightly cluster job

A new cluster-tests job in .github/workflows/test.yml runs pytest -n 0 --run-cluster-tests -m requires_cluster tests/ on the nightly schedule and on workflow_dispatch, and is skipped for pull requests and pushes. It runs on Python 3.11 across redis-py 6.x, 7.x and 8.x, because cluster replies differ by redis-py version: 8.x defaults to RESP3. The install step mirrors the test job's redis-py pinning. The run is serial because tests/cluster-compose.yml publishes fixed ports 7001–7006, which per-worker clusters under xdist would fight over.

Resolving host.docker.internal on Linux

Every cluster node announces host.docker.internal. That is the address the nodes gossip to each other, the one redis-cli --cluster create reconnects to while building the cluster, and the one the client is handed in MOVED redirects. So it has to resolve inside every container and on the host. Docker Desktop provides the name inside containers, but Linux Docker Engine, which GitHub's ubuntu runners use, does not. Every container in tests/cluster-compose.yml now maps it to host-gateway, and the job adds 127.0.0.1 host.docker.internal to the runner's /etc/hosts.

Cluster fixture no longer exports COMPOSE_PROJECT_NAME

redis_cluster_container in tests/conftest.py used to set COMPOSE_PROJECT_NAME to the cluster's project. The standalone redis_container fixture's testcontainers commands read that variable. So once a cluster test had run, redis_url looked for the standalone redis service in the cluster's project and raised ContainerIsNotRunning. Under -m requires_cluster a cluster test runs first, so the new job would have hit this on every leg. Every command in the cluster fixture already passes -p, so it now leaves the variable alone. This also stops the standalone container from leaking after a cluster run.

  • CONTRIBUTING.md now says the test host must resolve host.docker.internal, and that CI runs the suite nightly.
  • AGENTS.md and the pre-PR review references no longer say cluster tests never run in CI; they now say pull-request CI.

Notes

This PR is the top of a stack, #794 → #795 → #800 → this PR, because the new job would fail on main today. #794 fixes three cluster tests that silently used a single-node client, #795 fixes SearchIndex.info() and AsyncSearchIndex.info() on cluster clients, and #800 stops a cluster test from overrunning redis-py 8's per-node connection cap. The three fixes are independent; each branch merges the one below it only so that the stack is linear.

The job lives in test.yml rather than in a workflow of its own, so the nightly schedule stays in one place. The cost is that an on-demand run dispatches all of test.yml, including the service tests that use the provider API secrets.

Reviewer Brief

Start here: tests/cluster-compose.yml. The job only works if every container, and the runner, resolves the address the nodes announce, and this file is where most of that happens.

Where it could fail

  • tests/conftest.py:84: the cluster fixture no longer exports COMPOSE_PROJECT_NAME. Check that nothing else relied on that variable pointing at the cluster project after the fixture had run.
  • .github/workflows/test.yml, the cluster-tests install step: it copies the test job's redis-py case block, so a pin changed in only one copy leaves the nightly testing stale versions without failing.

Not verified: local runs against this compose file on macOS with the /etc/hosts entry (local runs used a stand-in topology announcing 127.0.0.1); Docker Desktop on Windows; more than one green run on Linux, though two of the failures this job first exposed were timing-dependent.

Beyond CI: a workflow_dispatch run on c220e6e3 (run 41057698156) formed the cluster on an ubuntu runner and passed all 22 cluster tests on redis-py 6.4.0, 7.4.1 and 8.1.0, with every other job in the workflow green. Before the conftest change, the job's test order made test_sync_client_validation error with ContainerIsNotRunning locally; after it, that test passes.

Since the last brief: merged the updated #795 and the new #800 below this PR in the stack; this PR's own diff is unchanged. The first dispatch, on a55375f0, failed three tests on redis-py 8.x, all fixed in those two PRs.

Reviewed 236b38de, fixes in a55375f0 · Claude Code (claude-opus-5-5) · lenses: correctness, security, design, tests, docs, Redis behaviour

Add a cluster-tests job to the test workflow that runs every
requires_cluster test on the nightly schedule and on manual dispatch,
across redis-py 6.x, 7.x and 8.x. None of these tests has run in CI
before.

The cluster nodes announce host.docker.internal, which Linux Docker
Engine does not resolve. Map it to the host gateway inside each node,
and to loopback on the runner, so the nodes can gossip and the client
can follow MOVED redirects. The job runs serially because the cluster
publishes fixed ports.

Co-Authored-By: Claude <noreply@anthropic.com>
@vishal-bala
vishal-bala added this pull request to stack #797 October 30, 2026 10:57
@vishal-bala vishal-bala added the auto:ci Updates to CI/CD workflows and processes label Oct 30, 2026
vishal-bala and others added 2 commits October 30, 2026 12:10
Two problems would have failed every leg of the new cluster job:

- redis_cluster_container exported COMPOSE_PROJECT_NAME. Under
  -m requires_cluster, a cluster test runs before anything resolves
  redis_url, which then looked up the standalone redis service in the
  cluster's compose project and raised ContainerIsNotRunning. Every
  command in the fixture already passes -p, so stop exporting it.
- redis-cluster-setup lacked the host.docker.internal mapping, but
  redis-cli --cluster create reconnects to the nodes at their announced
  address, so cluster creation could not finish on Linux.

Also correct a workflow comment, and update AGENTS.md and the pre-PR
review references, which said cluster tests never run in CI.

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
@vishal-bala
vishal-bala removed this pull request from stack #797 October 30, 2026 12:39
@vishal-bala
vishal-bala changed the base branch from fix/cluster-ft-info-resp3-async-init to fix/cluster-aclear-test-seed-with-amset October 30, 2026 12:39
@vishal-bala
vishal-bala added this pull request to stack #801 October 30, 2026 12:39

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto:ci Updates to CI/CD workflows and processes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant