Skip to content

Forward REDIS_PASSWORD to memtier in the test harness - #841

Merged
fcostaoliveira merged 2 commits into
masterfrom
claude/forward-redis-password-20261024
Oct 24, 2026
Merged

fcostaoliveira merged 2 commits into
masterfrom
claude/forward-redis-password-20261024

Conversation

@fcostaoliveira

@fcostaoliveira fcostaoliveira commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #826.

Problem

tests/run_tests.sh starts the servers with REDIS_PASSWORD (RLTest --oss_password), but memtier only got the password in tests that added --authenticate themselves. With a password set, most tests drove memtier into -NOAUTH Authentication required and many still passed. Forwarding the password from add_required_env_arguments() alone is not enough: in a full standalone run with only that, 47 of 2,633 memtier invocations still got NOAUTH (tests that build their own command line), and 12 tests failed only for that reason.

Change

  • tests/include.py: memtier_auth_args(env, args) returns --authenticate <password> with the env's password (RLTest node info, so it also works with --oss_password directly). It returns nothing when there is no password, when the args already carry credentials (-a/--authenticate, or -u/--uri with userinfo), or when they select a memcache protocol, which cannot AUTH as a Redis client. add_required_env_arguments() uses it.
  • Tests that build their own command line against the real server use it too: test_prometheus, test_prometheus_redaction, test_cli_fuzz_phase1 (at run time, so the empty-password and memcache cases stay as they are), test_retry_on_error, test_cli_validation_count_flags, test_cli_validation_sampler, test_sigpipe_immunity, test_reconnections.
  • test_mget_protocol: its MONITOR connection authenticates. Its thread swallowed NOAUTH, so each test saw 0 MGETs.
  • test_prometheus_redaction, test_retry_on_error: after setting a test password they restore the env's own, not "".
  • ci.yml: a "Single Endpoint: TCP Plaintext with auth" cell runs the standalone suite with REDIS_PASSWORD, so auth handling is covered suite-wide.

Without a password nothing is added, so memtier's arguments are unchanged.

Validation

  • Standalone suite with REDIS_PASSWORD: 866 run, 0 failed; 0 of 2,633 memtier invocations got NOAUTH (47 when only add_required_env_arguments() forwarded it).
  • Without a password: the touched tests plus tests_oss_simple_flow, test_config_password_redaction, test_realtime_latencies, test_verify_exit, test_unix_socket: 275 run, 0 failed.
  • 3-shard cluster with a password: test_prometheus, test_prometheus_redaction: 38 run, 0 failed.
  • test_426_17_wait_ratio_unsatisfiable exits 2 with and without authentication; it passed unauthenticated only because NOAUTH replies to WAIT count as responses. Not a memtier bug.

Affected versions

Test harness only. REDIS_PASSWORD support came in 62b237c (#809), which is in no release tag.

🤖 Generated with Claude Code


Note

Low Risk
Test-harness and CI matrix changes only; no memtier_benchmark runtime or production auth behavior is modified.

Overview
Fixes #826 by making the RLTest harness pass REDIS_PASSWORD through to memtier as --authenticate, so password-protected Redis envs no longer hit NOAUTH while tests still pass.

tests/include.py adds memtier_auth_args(env, args) (with _option_values for CLI parsing): it appends auth when the node has a password and skips when credentials are already present, URI userinfo is set, or memcache protocol is selected. add_required_env_arguments() uses it for the standard benchmark path.

Tests that build their own argv (prometheus, reconnections, cli fuzz, validation, sigpipe, retry_on_error, etc.) call the same helper; test_reconnections drops its local _add_auth_args. test_mget_protocol authenticates MONITOR/redis-py connections. test_prometheus_redaction and test_retry_on_error restore the env password after temporary requirepass changes instead of clearing it. test_cli_fuzz_phase1 skips the empty-password/no-auth case when the server requires auth.

CI adds a "Single Endpoint: TCP Plaintext with auth" matrix cell; run_tests.sh help text notes memtier forwarding.

Reviewed by Cursor Bugbot for commit e9a1f45. Bugbot is set up for automated code reviews on this repo. Configure here.

run_tests.sh starts the servers with REDIS_PASSWORD, but memtier only got
it in tests that added --authenticate themselves, so most tests drove
memtier into NOAUTH replies and many still passed. memtier_auth_args()
adds --authenticate with the env's password unless the args already carry
credentials or select a memcache protocol; add_required_env_arguments()
and the tests that build their own command lines use it. The MGET
protocol tests' MONITOR connection authenticates too, and tests that set
a password restore the env's own. A CI cell runs the standalone suite
with a password.

Fixes #826

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

Copy link
Copy Markdown

🤖 Automated first-pass review — a human maintainer's review is still required before merge.

Thanks, the write-up makes this easy to follow. Putting it in add_required_env_arguments() and skipping when the args already carry credentials or select memcache looks right to me, and nothing changes when no password is set. Two small things:

  • The new CI cell's comment says "every test must authenticate memtier", but by your own numbers 47 invocations got NOAUTH and most of those tests still passed. So the cell only catches a future self-built command line that forgets memtier_auth_args() if the NOAUTH replies happen to make that test fail. Did you consider having the mb.py / include.py run helpers fail when memtier's stderr has NOAUTH while the env has a password? Then the auth cell would actually enforce what the comment says, instead of relying on side effects.
  • Nitpicking: test_retry_on_error gets the password to restore from admin.connection_pool.connection_kwargs, while test_prometheus_redaction and memtier_auth_args() read the RLTest node's "password". Both probably give the same value, but reading it one way everywhere would be easier to follow.

The harness change itself looks solid to me. I'd just like the first point answered, even if the answer is that it's out of scope for this PR.

(would file this as a comment, not a formal block)

As in memtier, only the last --uri and --protocol count when deciding
whether memtier_auth_args adds --authenticate. test_reconnections uses it
instead of its own copy, and the empty-password fuzz case skips when the
server requires a password, as it no longer tests what it names.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@fcostaoliveira

Copy link
Copy Markdown
Collaborator Author

Thanks. Both points are taken, and I've moved them to a follow-up, #842, so this PR stays a plain forwarding fix.

  1. Right, the cell enforces less than its comment says. A review run with mutants confirmed it: with the password dropped from 4 of the hand-built command lines this PR fixes, every test still passes with 8 memtier runs answered NOAUTH. Failing on NOAUTH needs explicit opt-outs for the tests that are unauthenticated on purpose (memcache against Redis, own or wrong credentials, fake servers). Test harness: the auth CI cell passes when memtier gets NOAUTH replies #842 proposes checking errorstat_NOAUTH per test, or -NOAUTH in memtier's stderr, when the env has a password.
  2. Agreed. test_retry_on_error will read the RLTest node's "password" like the rest, also in Test harness: the auth CI cell passes when memtier gets NOAUTH replies #842. Both give the same value today.

@fcostaoliveira
fcostaoliveira merged commit e4e68c3 into master Oct 24, 2026
151 checks passed
fcostaoliveira added a commit that referenced this pull request Oct 24, 2026
Picks up #812, the reconnect deadline-clock fix for the never-started
client test that failed this branch's plaintext job, plus #828, #838 and
#841.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.

Test harness: REDIS_PASSWORD is not forwarded to memtier, so authenticated local runs pass against NOAUTH errors

1 participant