Skip to content

Commit

Permalink
add the h2c app protocol value for the HTTP2 test (#936)
Browse files Browse the repository at this point in the history
* add the h2c app protocol value for the HTTP2 test

* fix use of variadic param
  • Loading branch information
dprotaso authored Feb 26, 2024
1 parent 48f43ee commit ff63078
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 4 additions & 1 deletion test/conformance/ingress/basic.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ func TestBasicsHTTP2(t *testing.T) {
t.Parallel()
ctx, clients := context.Background(), test.Setup(t)

name, port, _ := CreateRuntimeService(ctx, t, clients, networking.ServicePortNameH2C)
name, port, _ := CreateRuntimeService(ctx, t, clients,
networking.ServicePortNameH2C,
networking.AppProtocolH2C,
)

// Create a simple Ingress over the Service.
_, client, _ := CreateIngressReady(ctx, t, clients, v1alpha1.IngressSpec{
Expand Down
8 changes: 6 additions & 2 deletions test/conformance/ingress/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func (ua *uaRoundTripper) RoundTrip(rq *http.Request) (*http.Response, error) {
// specified with the given portName. It returns the service name, the port on
// which the service is listening, and a "cancel" function to clean up the
// created resources.
func CreateRuntimeService(ctx context.Context, t *testing.T, clients *test.Clients, portName string) (string, int, context.CancelFunc) {
func CreateRuntimeService(ctx context.Context, t *testing.T, clients *test.Clients, portName string, appProtocol ...string) (string, int, context.CancelFunc) {
t.Helper()
name := test.ObjectNameForTest(t)

Expand Down Expand Up @@ -171,6 +171,10 @@ func CreateRuntimeService(ctx context.Context, t *testing.T, clients *test.Clien
},
}

if len(appProtocol) > 0 {
svc.Spec.Ports[0].AppProtocol = ptr.String(appProtocol[0])
}

return name, port, createPodAndService(ctx, t, clients, pod, svc)
}

Expand Down Expand Up @@ -558,7 +562,7 @@ func CreateGRPCService(ctx context.Context, t *testing.T, clients *test.Clients,
Name: networking.ServicePortNameH2C,
Port: int32(port),
TargetPort: intstr.FromInt(containerPort),
AppProtocol: ptr.String("kubernetes.io/h2c"),
AppProtocol: ptr.String(networking.AppProtocolH2C),
}},
Selector: map[string]string{
"test-pod": name,
Expand Down

0 comments on commit ff63078

Please sign in to comment.