Skip to content

test(e2e): port OTLP relay and SPIFFE token-exchange tests with environment-owned fixtures - #5978

Draft
matthewgrossman wants to merge 8 commits into
mainfrom
test/5976-otlp-spiffe-env-fixtures/matthewgrossman
Draft

matthewgrossman wants to merge 8 commits into
mainfrom
test/5976-otlp-spiffe-env-fixtures/matthewgrossman

Conversation

@matthewgrossman

@matthewgrossman matthewgrossman commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

What changed in the port, and why it's bigger

The legacy tests started their collector and SPIFFE Workload API inside the test process, so they bound fixed sockets the gateway was configured with and could run only one at a time. The port moves those services into the environment, so tests share one gateway and run concurrently:

  • OTLP: the environment runs an OpenTelemetry Collector that appends every export to a JSONL file. Each test names its spans with cx.name and reads only those from the file, instead of owning the collector.
  • SPIFFE: the environment runs the gateway's and supervisors' Workload API as a system service that generates its signing key at first start, so no private key is committed. Tests verify SVIDs against the JWKS it publishes and keep their token servers on ephemeral ports.
  • Inert relay test: it moves to its own package on a gateway with no collector, instead of conformance, where it would fail any gateway with the relay configured.

Excluding lockfiles, the diff is +2151/−2004 (+147):

Area Before After Why
Test files 1886, including the Workload API below 1002 Testkit replaces the sandbox, CLI and polling plumbing, and host-server-support's HttpRecorder replaces the token exchange test's own TCP servers and HTTP parsing. Without the Workload API, the tests go from ~1570 to 1002.
HttpRecorder — +154 Records each request's connection and size, counts every byte read, and waits for connections to close cleanly, so the targets keep their checks that nothing beyond whole requests arrived.
SPIFFE Workload API ~315, in the test file, with a committed test key 467: Python service 227, playbook 151, spiffe-support 89 A standalone gRPC service plus the systemd unit, key generation and both listeners.
OTLP collector 0, reused openshell-otel-test-support in-process 362: playbook 172, otlp-support 190 A container service, plus reading spans and duplicate resource keys from the collector's JSON instead of decoding protobuf in memory.
Wiring and manifests ~80 in the e2e wrappers and e2e/rust ~120 in config.nix, e2e-suites.yml and Cargo manifests Three packages and two support crates, each with a manifest.

The lockfiles add +702/−395 more: tests/suites/features and tests/support now pull in jsonwebtoken, openshell-otel and their dependencies, which e2e/rust drops.

Summary

Port the OTLP agent trace relay and SPIFFE token exchange tests from e2e/rust to testkit suites, with the collector and the Workload API stub owned by the environment instead of the tests. Tests check only their own spans and traffic, so they share one gateway and run with more than one worker. Split from #5792.

Related Issue

Closes #5976
Part of #5297

Changes

  • features/otlp-relay: agent_span_reaches_collector_with_attribution and span_emitted_before_exit_is_delivered. The <podman base>-otlp environments run a stock OpenTelemetry Collector for the environment's lifetime, point the gateway's OTLP export and agent relay at it, and publish its JSONL capture as OPENSHELL_TEST_OTLP_LOG (replacing OPENSHELL_TEST_OTLP_PORT). Each test names its spans with cx.name, waits for them, and checks attribution and duplicate resource keys only on those spans.
  • features/provider-token-exchange: independent_grants_across_sandboxes and routes_recover_and_select_a_b_a_on_one_connection. The <podman base>-spiffe environments run the gateway's and supervisors' Workload APIs as a system service (playbooks/files/spiffe-workload-api.py). It creates its signing key on first start, so no key is committed, and publishes the JWKS as OPENSHELL_TEST_SPIFFE_JWKS. Tests don't touch the socket; tests/support/spiffe only verifies SVIDs against the JWKS. The token servers stay on ephemeral ports.
  • features/otlp-relay-inactive: relay_is_inert_without_collector runs on ubuntu-docker-rootful, whose gateway has no OTLP export or agent relay, and fails if OPENSHELL_TEST_OTLP_ENDPOINT is set. test(e2e): port OTLP relay and SPIFFE token-exchange tests with environment-owned fixtures #5976 put it in conformance, but there it fails any gateway with the relay configured, and its log read is unreliable on k3s-ha (test(conformance): run the two sandbox-log tests on k3s-ha again #5752). The workload script uses only the Python standard library. e2e-suites.yml has no per-row filter.
  • tests/support/README.md: the environment contract table lists OPENSHELL_TEST_OTLP_LOG, OPENSHELL_TEST_OTLP_ENDPOINT and OPENSHELL_TEST_SPIFFE_JWKS.
  • e2e-suites.yml: rows for otlp-relay and provider-token-exchange on Podman rootless, and otlp-relay-inactive on Docker rootful.
  • Test targets: each uses harness = false with testkit::main(). The token-exchange profile stays YAML because testkit::Profile has no token_grant setter yet.
  • e2e/rust: removes otlp_relay.rs and provider_token_exchange.rs, their [[test]] entries and dependencies, their PODMAN_CI_TESTS entries, and the OTLP and SPIFFE wiring in the Docker and Podman wrappers.

This doesn't depend on #5792, so it's based on main. Whichever PR lands second gets a small conflict in e2e/rust/Cargo.toml and Cargo.lock.

Driver coverage

Test Before Now
OTLP relay, collector Podman Podman rootless
OTLP relay, inert Docker Docker rootful
provider token exchange Podman Podman rootless (SPIFFE)

Testing

Run locally through openshell-test-runner on tmachine:

  • otlp-relay: 2/2 on fedora-podman-rootless-otlp/rpm
  • provider-token-exchange: 2/2 on fedora-podman-rootless-spiffe/rpm
  • otlp-relay-inactive: 1/1 on ubuntu-docker-rootful/deb

Also run: cargo fmt --check and cargo clippy --all-targets --locked -D warnings for tests/support and tests/suites/features; cargo check of e2e/rust with the Docker and Podman features; check-cargo-lockfiles.sh and check_cargo_lockfile_alignment.py; ruff check and ruff format --check on the Workload API stub.

  • Checks appropriate to the affected code and behavior pass
  • Unit tests added/updated (if applicable)
  • E2E tests added/updated (if applicable)

Checklist

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

Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
@matthewgrossman matthewgrossman added test:e2e Requires end-to-end coverage topic:testing Unit, integration, regression, conformance, E2E tests, coverage, flakes, and test infrastructure. labels Nov 25, 2026
@matthewgrossman
matthewgrossman force-pushed the test/5976-otlp-spiffe-env-fixtures/matthewgrossman branch from 150287b to 93ebcf3 Compare November 25, 2026 19:29
…ronment services

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

Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
@matthewgrossman
matthewgrossman force-pushed the test/5976-otlp-spiffe-env-fixtures/matthewgrossman branch from 93ebcf3 to 574df06 Compare November 25, 2026 20:13
…a collector

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

Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
@matthewgrossman
matthewgrossman force-pushed the test/5976-otlp-spiffe-env-fixtures/matthewgrossman branch from 574df06 to dd67b24 Compare November 25, 2026 20:41
…r connections to close

HttpRecorder now numbers each request's connection, counts every byte it reads, reads multi-valued headers, takes a read timeout, and waits for every connection to close at a request boundary. A test can then check that nothing beyond whole requests reached a server.

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

The provider token exchange tests replace their own TCP servers and HTTP parsing with host-server-support recorders. The targets check forwarded bytes, connections and closes through the recorder, so every assertion stays.

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

test:e2e Requires end-to-end coverage topic:testing Unit, integration, regression, conformance, E2E tests, coverage, flakes, and test infrastructure.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(e2e): port OTLP relay and SPIFFE token-exchange tests with environment-owned fixtures

1 participant