Skip to content

Add end-to-end coverage for HTTPS and WebSocket egress - #1634

Open
Adhita Selvaraj (swiftdiaries) wants to merge 2 commits into
agent-substrate:mainfrom
swiftdiaries:swiftdiaries/e2e_egress_tests
Open

Add end-to-end coverage for HTTPS and WebSocket egress#1634
Adhita Selvaraj (swiftdiaries) wants to merge 2 commits into
agent-substrate:mainfrom
swiftdiaries:swiftdiaries/e2e_egress_tests

Conversation

@swiftdiaries

@swiftdiaries Adhita Selvaraj (swiftdiaries) commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Fixes #1017

  • Tests pass
  • Appropriate changes to documentation are included in the PR

PR Description

Adds actor egress coverage for HTTPS/1.1 on port 8443, HTTP upgrade to WebSocket, and HTTPS upgrade to WebSocket. Each test owns its actor and origin, checks the negotiated protocol and verified TLS where applicable, and matches the gateway destination and actor SPIFFE identity. WebSocket cases also verify three ordered text echoes after the 101 upgrade.

Extends the egress demo and test origins with request-scoped CA trust, TLS and WebSocket support, plus Service IP allocation and endpoint readiness helpers. No product behavior changes are included.

Validation

  • All three E2E tests passed on an isolated IPv4 Kind cluster using Envoy passthrough and gVisor (54.8 seconds).
  • Targeted race tests and the full Go race suite passed. Code generation, formatting, module checks, lint, Kubernetes API lint, licenses, migrations, protobuf formatting, and threat checks passed in a clean disposable snapshot.
  • Couldn't run full make verify: metrics and spellcheck wasn't run

@swiftdiaries

Copy link
Copy Markdown
Contributor Author

/assign haiyanmeng


// TestActorEgressHTTPSNonStandardPort verifies HTTP/1.1 inside TLS while
// preserving the original destination port through the egress tunnel.
func TestActorEgressHTTPSNonStandardPort(t *testing.T) {

@swiftdiaries Adhita Selvaraj (swiftdiaries) Sep 13, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

review note: this is the only major file where we have the test cases that were asked for. others are all test setup code.

test case 1: Actor connects to 8443, verifies TLS, uses HTTP/1.1, and receives the expected response.

assertProtocolGateway(t, ctx, since, actorName, target.Address())
}

func TestActorEgressWebSocket(t *testing.T) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

review note:

  • test case 2: Actor sends an HTTP/1.1 upgrade request on 80, receives 101 Switching Protocols, then exchanges three text messages.

assertWebSocketExchange(t, got, messages, false)
}

func TestActorEgressSecureWebSocket(t *testing.T) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

review note:

  • test case 3: Actor establishes verified TLS on 443, performs the HTTP/1.1 upgrade inside TLS, receives 101, then exchanges three text messages.

// assertWebSocketExchange checks the outbound handshake and every reply on
// the same connection. want lists the sent messages in order; wantTLS states
// whether the actor must have verified the origin certificate.
func assertWebSocketExchange(t *testing.T, got egressWebSocketResponse, want []string, wantTLS bool) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

review note: equivalent for assertProtocolGateway

@swiftdiaries

Copy link
Copy Markdown
Contributor Author

The test setup part ended up being bigger than I would have liked. Please let me know if there's something that I can trim down or reuse. I'm re-checking for this myself as well.

@haiyanmeng haiyanmeng self-assigned this Sep 13, 2026
@haiyanmeng
haiyanmeng self-requested a review September 13, 2026 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add e2e test coverage for non-HTTP egress traffic

2 participants