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

add the h2c app protocol value for the HTTP2 test #936

Merged
merged 2 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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),
Copy link
Member Author

Choose a reason for hiding this comment

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

Realized there's a constant where this value is defined

}},
Selector: map[string]string{
"test-pod": name,
Expand Down
Loading