Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OCPBUGS-27210: Restore HTTP/2 tests in test/extended/router #28540

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
43 changes: 36 additions & 7 deletions test/extended/router/http2.go
Expand Up @@ -38,22 +38,39 @@ const (
http2ClientTimeout = 1 * time.Minute
)

// makeHTTPClient creates a new HTTP client, configurable for timeout
// duration and optional HTTP/2 support.
//
// When useHTTP2Transport is true, the function enables HTTP/2 support
// via http2.ConfigureTransport, modifying the http.Transport to
// support HTTP/2 with a fallback to HTTP/1.1. If useHTTP2Transport is
// false, the client defaults to HTTP/1.1. The protocol selection
// between HTTP/2 and HTTP/1.1 occurs during the TLS handshake through
// ALPN, defaulting to HTTP/1.1 if HTTP/2 is not mutually agreed upon.
//
// This client is also configured with TLS settings that skip
// certificate verification (InsecureSkipVerify).
//
// The function returns a pointer to the configured http.Client.
func makeHTTPClient(useHTTP2Transport bool, timeout time.Duration) *http.Client {
tlsConfig := tls.Config{
InsecureSkipVerify: true,
}

transport := &http.Transport{
TLSClientConfig: &tlsConfig,
}

c := &http.Client{
Timeout: timeout,
Transport: &http.Transport{
TLSClientConfig: &tlsConfig,
},
Timeout: timeout,
Transport: transport,
}

// If HTTP/2 is to be used, configure it to allow falling back
// to HTTP/1.1
if useHTTP2Transport {
c.Transport = &http2.Transport{
TLSClientConfig: &tlsConfig,
}
// Explicitly allow HTTP/2.
http2.ConfigureTransport(transport)
}

return c
Expand Down Expand Up @@ -408,6 +425,18 @@ var _ = g.Describe("[sig-network-edge][Conformance][Area:Networking][Feature:Rou
backendProto: "HTTP/2.0",
statusCode: http.StatusOK,
useHTTP2Transport: true,
}, {
route: "http2-default-cert-edge",
statusCode: http.StatusOK,
frontendProto: "HTTP/1.1",
backendProto: "HTTP/1.1",
useHTTP2Transport: true,
}, {
route: "http2-default-cert-reencrypt",
statusCode: http.StatusOK,
frontendProto: "HTTP/1.1",
backendProto: "HTTP/2.0", // reencrypt always has backend ALPN enabled
useHTTP2Transport: true,
}, {
route: "http2-custom-cert-edge",
frontendProto: "HTTP/1.1",
Expand Down