Skip to content

test(k8s): k8s command tests patch no devops_cli names - #4105

Merged
dan-petty merged 5 commits into
mainfrom
test/3769-k8s-command-tests-on-edge-fakes
Nov 8, 2026
Merged

dan-petty merged 5 commits into
mainfrom
test/3769-k8s-command-tests-on-edge-fakes

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

The tests of the devops k8s group now patch no devops_cli name. They use the shared fakes for the process, the cluster, HTTP, the keyring and the clock. A new tcp_probe fixture answers the TCP probes that no seam reaches.

The product code loses the test accommodations that the patches needed: the _K8sModule patch forwarding, _k8s_clients and a direct Popen call. A test in tests/invariants/test_source_tree.py keeps the group at zero string patches.

Closes #4086
Change: openspec/changes/archive/2026-11-08-4086-k8s-command-tests-on-edge-fakes/

Delete _K8sModule and its name sets, which only the command tests needed.
Read the contexts and the nodes through KubernetesService, delete _k8s_clients,
and start the port-forward child through spawn_detached.

Refs #4086
Move the tests of tests/commands/k8s to the shared fakes: process_fake,
cluster, web, scanner_fake, keyring_store, clock and a new tcp_probe fixture.
Hold the directory to zero string patches of a devops_cli name with an
invariant test. Plan the change as 4086 and replace the stale plan of 1323.

Refs #4086
@dan-petty dan-petty added type/test Type test: a new or changed test scope/k8s Kubernetes commands, Helm charts, pods, services, and policies labels Nov 8, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Check results (local, on the final code, after the rebase onto origin/main):

  • Full uv run devops ci: all 25 rows pass. The test row took 10m 6s, which is over the 5-minute budget on this loaded host.
  • Focused run of tests/commands/k8s, tests/k8s and tests/invariants: 1836 passed.

Review fixes after the independent review:

  • design.md names the real class, FakeCluster, and says that tests/support/k8s_commands.py aliases it as KubectlWorld.
  • tcp_probe has a test of its own (listen, refuse, probed list), and a new test shows that a URL with no port is probed on port 80.
  • The test of the proxy mode with no installed component now runs through configure-urls and a real settings object. It no longer uses MagicMock or the private helper.
  • proposal.md states the real behavior differences of status and contexts, and has no follow-up text.
  • test_deploy_and_teardown_stack_use_effective_context has a comment that says why it uses the logging stack (defect fix(k8s): credential sync refuses a context that is no RFC 1123 name #4091).

Known leftovers, for later items:

@dan-petty
dan-petty marked this pull request as ready for review November 8, 2026 01:39
@dan-petty
dan-petty merged commit 625f801 into main Nov 8, 2026
25 checks passed
@dan-petty
dan-petty deleted the test/3769-k8s-command-tests-on-edge-fakes branch November 8, 2026 03:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/k8s Kubernetes commands, Helm charts, pods, services, and policies type/test Type test: a new or changed test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(k8s): k8s command tests patch no devops_cli names

1 participant