Repository navigation
Description
Problem or Motivation
Issue #3769 asks that no command test patches a name inside devops_cli. It splits the work by command group. This item is group 4: the Cloudflare and Valkey command tests, and every command test under tests/commands that groups 1 to 3 do not cover (the k8s, pr, gh, repos, ci and test_selection tests).
Measured at origin/main 74ba76b (2026-11-07), group 4 holds 328 string patches of a devops_cli name in 30 test files. The largest files are test_devcontainer.py (45), test_cloudflare_commands.py (36), test_analyze.py (28), test_valkey.py (27) and test_tf.py (25).
Each of these patches doubles code inside the process (commands.cloudflare.load_settings, commands.cloudflare._resolve_client, commands.valkey._resolve_client) instead of the edge that the command reaches. Issue #1336 turns the ratchets into bans and fails on these patches.
Proposed Solution & Architectural Design
Replace each patch with a double of the edge that the command reaches:
- Settings come from the
configfixture, not from a patch ofload_settings. - The Cloudflare API is faked at the HTTP edge with the
webfixture, with the token in the keyring fake. - Valkey is faked with the in-memory server of
tests/support/fakes/valkey.py, or with a loopback listener that records the commands. - Programs are faked with
process_fake.
Commands are tested through the cli fixture. A test keeps its name and the behavior it checks. This item takes the largest coherent files first (Cloudflare and Valkey) and then the next biggest files that fit one reviewable pull request.
Acceptance criteria
- The files that the pull request migrates hold no string patch of a
devops_cliname. - Each migrated test keeps its node id, and the collected ids of the migrated files match before and after.
- A product mutation in a scratch copy makes the migrated tests fail.
- The pull request states the count of string patches of the group before and after, and lists each patch that stays with its reason.
Existing tool considered
No new tool is needed. pytest with the fakes of tests/support/fakes/ (HTTP, process, Valkey, keyring), the config fixture and the cli fixture cover the need. All of them exist.
Related
Related: #3769
Activity
dan-petty commentedon Nov 7, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
testprefix of the title gives the type.(cli)scope of the title gives the scope.This is a test refactoring task that improves maintainability but does not block a release or fix a user-facing defect.It removes 328 fragile internal patches across 30 files, making the test suite more robust and easier to maintain.Migrating 328 patch sites across 30 test files with new edge fakes for Cloudflare, Valkey, and other commands is substantial work.Both target removing devops_cli name patches from command tests, but #3769 is the umbrella for all groups while this candidate covers only group 4 (Cloudflare, Valkey, and remaining files).