Skip to content

Migrate backend_protocol, backend_tls, and service_upstream tests to e2e - #73

Open
asklokesh wants to merge 2 commits into
kgateway-dev:mainfrom
asklokesh:feat/e2e-test-coverage-26
Open

Migrate backend_protocol, backend_tls, and service_upstream tests to e2e#73
asklokesh wants to merge 2 commits into
kgateway-dev:mainfrom
asklokesh:feat/e2e-test-coverage-26

Conversation

@asklokesh

Copy link
Copy Markdown

Related to #26

This PR migrates three integration tests to e2e tests as part of improving e2e test coverage:

Tests Migrated

  • backend_protocol.yaml - Tests GRPC backend-protocol annotation support with service-upstream
  • backend_tls.yaml - Tests backend TLS configuration with BackendConfigPolicy
  • service_upstream.yaml - Tests service-upstream annotation creating Backend resources

Additional Changes

Fixed the golden test by adding proxy-buffering: "on" annotations to ingresses that use buffer size annotations. This is required after the fix in PR #72 where proxy-buffering must be explicitly enabled for buffer annotations to be processed (matching nginx-ingress default behavior).

Testing

  • All integration tests pass
  • Verified generated output matches expected output for all three new e2e tests
  • Golden test now passes with updated proxy-buffering annotations

Remaining Work for Issue #26

After this PR, all tests from the checklist have been migrated (timeouts.yaml doesn't exist in the codebase).

This PR completes the work for issue #26.

@asklokesh

Copy link
Copy Markdown
Author

Updated tests to use correct service name and port:

  • Changed from echo (port 80) to echo-backend (port 8080)
  • This matches the shared backend service deployed by the e2e test framework
  • Without this fix, tests would fail because the echo service doesn't exist in the e2e environment

@asklokesh

Copy link
Copy Markdown
Author

Test Status Update

Discovered that all e2e tests in the kgateway emitter are currently failing due to an infrastructure issue (see #74).

Problem: Gateway resources are created successfully with status, but HTTP requests timeout. The kgateway controller logs show "no perclient clusters; defer building snapshot", indicating Envoy cannot build backend cluster configuration.

Validation Completed:

Evidence: Tested on both fresh and reused kind clusters, on both this PR branch and the parent commit (0af462e) - all e2e tests fail consistently with the same infrastructure issue.

This PR is ready for review pending resolution of #74.

@asklokesh
asklokesh force-pushed the feat/e2e-test-coverage-26 branch from 253bcc1 to b12486b Compare January 27, 2026 03:27
Fixes kubernetes-sigs#64

Changes:
- Add proxy-buffering annotation constant
- Update bufferPolicyFeature to skip processing when proxy-buffering is not 'on'
- Update proxyBodySizeFeature to skip processing when proxy-buffering is not 'on'
- Add comprehensive tests for both features

According to nginx-ingress documentation, buffering is disabled by default.
Buffer size annotations (client-body-buffer-size and proxy-body-size) should
only be processed when proxy-buffering is explicitly set to 'on'.

The annotations are now ignored when:
- proxy-buffering is set to 'off'
- proxy-buffering annotation is not present (default behavior)

Signed-off-by: asklokesh <lokeshmure@live.com>
…e2e tests

Related to kubernetes-sigs#26

This commit migrates the following integration tests to e2e tests:
- backend_protocol: Tests GRPC backend-protocol annotation support
- backend_tls: Tests backend TLS configuration with BackendConfigPolicy
- service_upstream: Tests service-upstream annotation creating Backend resources

Also fixes the golden test by adding proxy-buffering: "on" annotations
to ingresses that use buffer size annotations, which is required after
the fix in PR kubernetes-sigs#72 (proxy-buffering must be explicitly enabled for
buffer annotations to be processed).

Changes:
- Added test/e2e/emitters/kgateway/testdata/input/backend_protocol.yaml
- Added test/e2e/emitters/kgateway/testdata/output/backend_protocol.yaml
- Added test/e2e/emitters/kgateway/testdata/input/backend_tls.yaml
- Added test/e2e/emitters/kgateway/testdata/output/backend_tls.yaml
- Added test/e2e/emitters/kgateway/testdata/input/service_upstream.yaml
- Added test/e2e/emitters/kgateway/testdata/output/service_upstream.yaml
- Added TestBackendProtocol, TestBackendTLS, TestServiceUpstream to e2e_test.go
- Updated golden.yaml with proxy-buffering annotations

Signed-off-by: asklokesh <lokeshmure@live.com>
@asklokesh
asklokesh force-pushed the feat/e2e-test-coverage-26 branch from b12486b to 9de35ce Compare January 27, 2026 03:28
Comment on lines +30 to +33
const (
clientBodyBufferSizeAnnotation = "nginx.ingress.kubernetes.io/client-body-buffer-size"
proxyBufferingAnnotation = "nginx.ingress.kubernetes.io/proxy-buffering"
)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I closed #64 as an invalid bug, so please remove commit 5640e87 from this PR.

})
}

func TestBackendProtocol(t *testing.T) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

To properly test backend protocol, we need the echo server configured for gRPC (xref) and the tooling to make gRPC requests (see Gateway API gRPC conformance tests as a reference).

Comment on lines +680 to +700
// Test HTTP connectivity via Ingress
testutils.MakeHTTPRequestEventually(t, kubeContext, testutils.HTTPRequestConfig{
HostHeader: ingressHostHeader,
Scheme: "http",
Address: ingressIP,
Port: "",
Path: "/",
ExpectedStatusCode: 200,
Timeout: 1 * time.Minute,
})

// Test HTTP connectivity via Gateway
testutils.MakeHTTPRequestEventually(t, kubeContext, testutils.HTTPRequestConfig{
HostHeader: host,
Scheme: "http",
Address: gwAddr,
Port: "80",
Path: "/",
ExpectedStatusCode: 200,
Timeout: 1 * time.Minute,
})

@danehans danehans Jan 28, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Similar here- we need to make HTTPS requests to the echo backend server's HTTPS_PORT, update ApplyEchoBackend() so the Service include an HTTPS endpoint, etc.

Comment on lines +8 to +31
tls.crt: |
-----BEGIN CERTIFICATE-----
MIIBkTCB+wIJAKHHCgVZfULhMA0GCSqGSIb3DQEBCwUAMBExDzANBgNVBAMMBnRl
c3RjYTAeFw0yMzAxMDEwMDAwMDBaFw0yNDAxMDEwMDAwMDBaMBExDzANBgNVBAMM
BnRlc3RjYTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAw7Hs7hf5Z1JQ0v3F
e5z8HzF3Y0YKj2cPqR3xK5dN7rH5V8p5Y0YKj2cPqR3xK5dN7rH5V8p5Y0YKj2cP
qR3xK5dN7rH5V8p5Y0YKj2cPqR3xK5dN7rH5V8p5Y0YKj2cPqR3xK5dN7rH5V8p5
Y0YKj2cPqR3xK5dN7rH5V8p5Y0YKj2cPqR3xK5dN7rCAwEAAaMQMA4wDAYDVR0T
BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOBgQBWvL5S8f0H0Z8A8N3F0H0H0H0H0H0H
0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H
0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H
0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H
==
-----END CERTIFICATE-----
tls.key: |
-----BEGIN PRIVATE KEY-----
MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAMOx7O4X+WdSUNL9
xXuc/B8xd2NGCo9nD6kd8SuXTe6x+VfKeWNGCo9nD6kd8SuXTe6x+VfKeWNGCo9n
D6kd8SuXTe6x+VfKeWNGCo9nD6kd8SuXTe6x+VfKeWNGCo9nD6kd8SuXTe6x+VfK
eWNGCo9nD6kd8SuXTe6x+VfKeWNGCo9nD6kd8SuXTe6xAgMBAAECgYEAwqDN+P3n
H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0
H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0H0
-----END PRIVATE KEY-----
---

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

certs need to be added to the backend echo server (xref).

@danehans

danehans commented Feb 9, 2026

Copy link
Copy Markdown
Collaborator

@asklokesh are you still able to work on this PR?

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.

2 participants