Skip to content

test(sandbox): sandbox tests run on process, Docker and OTLP fakes - #3781

Merged
dan-petty merged 15 commits into
mainfrom
test/1335-sandbox-tests-on-fakes
Nov 6, 2026
Merged

dan-petty merged 15 commits into
mainfrom
test/1335-sandbox-tests-on-fakes

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

Seven sandbox test files reach sandbox/ through patches and private names (#3749, part 4 of 6 of #1335). Measured on origin/main (44d9196) with the counting rules of #1335, they hold 70 patch sites, 28 private imports, 267 tests, 16 CliRunner() calls and a catch-all test. The patches replace WorkloadSandboxEngine, the registry, metrics functions, trace_span, probe_tcp, the telemetry settings and the console objects. A test that patches an internal name pins how the code is wired and not what it does. The Docker, process and OTLP fakes and the real registry already give the same answers through the public interface. The span fallback in commands/sandbox.py (_resolve_spans_for_traces) is domain logic. It has nothing that is specific to the sandbox, and a test can reach it only through the command.

Closes #3749

Change: openspec/changes/archive/2026-11-06-3749-sandbox-tests-on-fakes/

@dan-petty dan-petty added type/test Type test: a new or changed test scope/sandbox The bubblewrap sandbox and its egress rules labels Nov 6, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Results

Counts on the seven files of #3749: patch sites 70 to 2, private imports 28 to 0. The 2 patch sites left are seam patches.

Tests run after the last rebase onto origin/main (tests/sandbox, the sandbox command tests and tests/telemetry/test_trace_span_resolution.py): 589 passed, 1 skipped. The pre-push static checks passed.

Deleted tests

  • test_terminate_process_group_guards_devcontainer (tests/sandbox/test_host_sandbox.py). The same guards are tested at their source in tests/core/test_process.py.
  • test_an_entry_that_resolves_to_no_address_adds_no_rule (networking tests). test_a_loopback_entry_opens_no_egress_rule shows the same rule through to_k8s_network_policy.
  • test_archive_panic_incident_chmod_failure. The failed-chmod branch of archive_incident is gone: the file is private from its creation (mode 0o600).

Review fixes

  • Removed the devops_cli.main import and its noqa from tests/sandbox/test_sandbox_network_config.py.
  • Removed the clause or not trace_id from resolve_trace_spans_or_latest. It never changed the result.
  • The open plans 2526 and 2554 now name the renamed test files.
  • Added a note on the temporary directory root to tests/sandbox/test_sandbox_cgroup_metrics.py.

Known limit

Two tests in test_sandbox_network_policy.py use SandboxNetworkConfig.model_construct to reach the CIDR branch of _resolve_public_host. The validator refuses that input. This is bug #3776. When #3776 is fixed, move these cases to a normal constructor, or delete the branch if #3776 closes as not planned.

@dan-petty
dan-petty marked this pull request as ready for review November 6, 2026 08:25
@dan-petty
dan-petty merged commit 8714474 into main Nov 6, 2026
24 checks passed
@dan-petty
dan-petty deleted the test/1335-sandbox-tests-on-fakes branch November 6, 2026 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/sandbox The bubblewrap sandbox and its egress rules type/test Type test: a new or changed test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(sandbox): sandbox tests run on edge fakes

1 participant