Skip to content

test(testkit): share TLS host servers, a gateway settings role and the environment contract table - #5780

Open
matthewgrossman wants to merge 9 commits into
test/5655-port-network-l7-policy/matthewgrossmanfrom
test/5728-share-environment-helpers/matthewgrossman
Open

matthewgrossman wants to merge 9 commits into
test/5655-port-network-l7-policy/matthewgrossmanfrom
test/5728-share-environment-helpers/matthewgrossman

Conversation

@matthewgrossman

@matthewgrossman matthewgrossman commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds the helpers that the next three e2e/rust ports (#5729, #5730, #5731) share, so each port doesn't write its own copy: the tests/support environment contract table, a gateway_overrides tmachine role, and TLS for host test servers.

This PR stacks on #5665 (base: test/5655-port-network-l7-policy/matthewgrossman), because the TLS server builds on its HttpRecorder::serve. It moves to main after #5665 merges.

Related Issue

Closes #5728
Part of #5281

Changes

  • tests/support/README.md: one row for each variable an environment, the runner or CI sets for tests to read, including OPENSHELL_TEST_UNSUPPORTED from feat(testkit): run conformance as one program and add unsupported-test entries #5755. It also says the other OPENSHELL_TEST_* names are internal test hooks, and gives the OPENSHELL_TEST_<SERVICE>_PORT rule for ports the environment chooses (the test binds the port on every host address). The runner-set OPENSHELL_GATEWAY and OPENSHELL_BIN link to testkit's docs. TESTING.md links to it.
  • roles/gateway_overrides: takes gateway_overrides_name and gateway_overrides_content and writes a marked block per name in /etc/openshell-test/gateway-overrides.toml, so writers keep each other's settings. gateway_overrides_state: absent removes one name's block and keeps the rest. Content must start with a table header. When feat(gateway): merge drop-in configs over the base file #5489 lands, only this role changes. The installers skip an empty overrides file.
  • The three override writers on main now use the role: playbooks/drivers/podman/userns.yaml, the cdi_fixtures role and the openshell_external_driver role. All three used to replace the whole file, and the external-driver role runs during install, after environment setup. The userns default mode now removes only its own block; it used to delete the whole file. test(conformance): run the conformance suite against a gateway that pushes configuration #5622 (config-push.yaml) and test(e2e): port Docker and Podman driver feature tests from e2e/rust #5695 (driver-config.yaml) switch to the role when they rebase.
  • merge_gateway_toml_test.py: covers a file with several marked blocks, and two blocks that declare the same table, which fails.
  • tests/support/host-server TLS, built on openshell-crypto and tokio-rustls:
    • Server certificates carry the authority key identifier, TLS handshakes time out after the read timeout, and TestCa::from_files rejects a key that doesn't match the certificate.
    • TestCa::new() makes a CA only the test knows. TestCa::from_env() loads the environment's additional CA from the files that OPENSHELL_TEST_ADDITIONAL_CA_CERT and OPENSHELL_TEST_ADDITIONAL_CA_KEY name, and fails if either is unset. TestCa::from_files and ca.cert_pem() are also there.
    • ca.leaf(&[names]) returns an Identity (certificate and key PEM). A name that parses as an IP address becomes an IP entry.
    • HttpRecorder::serve_tls(&identity, handler) and start_tls(&identity, body) are the TLS versions of serve and start. The connection code now takes any stream, so plain HTTP, TLS and the WebSocket recorder share it.
    • HttpRecorder::builder() picks the port and TLS: .port(port) listens on a given port (a random free port stays the default), and .tls(&identity) serves TLS. start, serve, start_tls and serve_tls are shorthands for it. test(e2e): port corporate-proxy tests from e2e/rust to features/corporate-proxy #5730's bypass upstream binds OPENSHELL_TEST_CORPORATE_PROXY_BYPASS_PORT this way.
    • Nothing sets the additional-CA variables yet. The environment comes with test(e2e): port gateway-configuration tests that need no restart from e2e/rust to feature suites #5729, and the contract table says so.

Testing

  • uv run --with pytest pytest tests/tmachine/ansible/roles/openshell_gateway/files/merge_gateway_toml_test.py (13 passed)
  • ansible-playbook --syntax-check on drivers/podman/userns.yaml, cdi.yaml, openshell-deb.yaml
  • The role and drivers/podman/userns.yaml run as root in a Linux container: blocks for several names coexist, re-writing a name replaces its block, default after private removes only the userns block, default on a fresh guest creates no file, and content without a table header fails
  • Existing E2E rows (CDI, Podman userns, external driver) still pass: needs Branch E2E (test:e2e)
  • cargo test -p host-server-support (19 passed). The new TLS tests check that a client trusting the CA gets an answer by DNS name and by IP, that another name or another CA is rejected, that from_env loads CA files and fails naming the missing variable, that a chosen port is used and a taken one fails naming it, that a CA key from another CA is rejected at load time, and that server certificates carry the authority key identifier (strict verifiers such as Python 3.13+ require it)
  • cargo fmt --check and cargo clippy --all-targets -D warnings on tests/support, tests/suites/conformance and tests/suites/features; check_cargo_lockfile_alignment.py

Checklist

  • Follows Conventional Commits
  • Commits are signed off (DCO)

@copy-pr-bot

copy-pr-bot Bot commented Nov 19, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
…settings

Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
…an empty file

Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
Add the authority key identifier to server certificates, which strict
verifiers such as Python 3.13 require, time out TLS handshakes, report CA
load failures as such, and keep test CA files in temporary directories.
The contract table now names environment-chosen ports
OPENSHELL_TEST_<SERVICE>_PORT, matching HttpRecorder's port option.

Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
@matthewgrossman
matthewgrossman force-pushed the test/5728-share-environment-helpers/matthewgrossman branch from d1cf453 to 8005863 Compare November 20, 2026 05:50
@matthewgrossman matthewgrossman added the test:e2e Requires end-to-end coverage label Nov 20, 2026
@matthewgrossman
matthewgrossman marked this pull request as ready for review November 20, 2026 05:50
@github-actions

Copy link
Copy Markdown

Label test:e2e applied, but pull-request/5780 does not exist yet. A maintainer needs to comment /ok to test 8005863c691ac996ed118934041bca7508b48ff5 to mirror this PR. Once the mirror exists, re-apply the label or re-run Branch E2E Checks from the Actions tab.

@matthewgrossman

Copy link
Copy Markdown
Member Author

/ok to test 8005863

matthewgrossman added a commit that referenced this pull request Nov 20, 2026
…matthewgrossman

Take #5728's side for the files it owns, and publish the bypass port as
OPENSHELL_TEST_CORPORATE_PROXY_BYPASS_PORT, following its renamed
OPENSHELL_TEST_<SERVICE>_PORT convention.

Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
…/matthewgrossman' into test/5728-share-environment-helpers/matthewgrossman

Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>

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

state:accepted A maintainer decided OpenShell should pursue this issue test:e2e Requires end-to-end coverage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant