Skip to content

Conversation

salonichf5
Copy link
Contributor

What type of PR is this?
Adds conformance tests

What this PR does / why we need it:

Conformance tests support for GRPCRouteFilterRequestHeaderModifier

Which issue(s) this PR fixes:

Fixes #2900

Does this PR introduce a user-facing change?:

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Sep 2, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: salonichf5
Once this PR has been reviewed and has the lgtm label, please assign shaneutt for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Sep 2, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @salonichf5. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@salonichf5
Copy link
Contributor Author

Test results in regular mode -- PASS

        --- PASS: TestConformance/GRPCRouteRequestHeaderModifier/Remove_headers_--_X-Header-Remove_should_be_removed (0.05s)
        --- PASS: TestConformance/GRPCRouteRequestHeaderModifier/Add_headers_--_X-Header-Add_should_should_append_to_the_original_value (0.05s)
        --- PASS: TestConformance/GRPCRouteRequestHeaderModifier/Set_headers_--_X-Header-Set_should_get_overwritten_with_the_original_value (0.05s)
        --- PASS: TestConformance/GRPCRouteRequestHeaderModifier/Set_headers_--_X-Header-Set_should_have_the_original_value (0.05s)
        --- PASS: TestConformance/GRPCRouteRequestHeaderModifier/Add_headers_--_X-Header-Add_should_have_the_original_value (0.05s)
        --- PASS: TestConformance/GRPCRouteRequestHeaderModifier/Multiple_operations_-_all_header_operations_should_be_applied (0.05s)
        --- PASS: TestConformance/GRPCRouteRequestHeaderModifier/Case_sensitivity_check_for_header_names (0.05s)

@salonichf5
Copy link
Contributor Author

I’m looking for guidance on how to set the correct test expectations for headers in Mesh mode.

Currently, I don’t see any request headers being applied as expected. My baseline check—where I simply assert a 200 response and verify that request headers I send are included—passes without issue:

expected := http.ExpectedResponse{
					Request: request,
					Response: http.Response{
						StatusCode: 200,
					},
					Namespace: "gateway-conformance-mesh",
				}



    --- PASS: TestConformance/MeshGRPCRouteRequestHeaderModifier (0.10s)
        --- PASS: TestConformance/MeshGRPCRouteRequestHeaderModifier/Add_headers_--_X-Header-Add_should_have_the_original_value (0.40s)
        --- PASS: TestConformance/MeshGRPCRouteRequestHeaderModifier/Set_headers_--_X-Header-Set_should_have_the_original_value (0.40s)
        --- PASS: TestConformance/MeshGRPCRouteRequestHeaderModifier/Multiple_operations_-_all_header_operations_should_be_applied (0.40s)
        --- PASS: TestConformance/MeshGRPCRouteRequestHeaderModifier/Remove_headers_--_X-Header-Remove_should_be_removed (0.41s)
        --- PASS: TestConformance/MeshGRPCRouteRequestHeaderModifier/X-Header-Add_should_append_the_new_value_to_the_original_value (0.40s)
        --- PASS: TestConformance/MeshGRPCRouteRequestHeaderModifier/Case_sensitivity_check_for_header_names (0.42s)
        --- PASS: TestConformance/MeshGRPCRouteRequestHeaderModifier/Set_headers_--_X-Header-Set_should_get_overwritten_with_the_original_value (0.43s)

However, when I try to add expectations for expectedHeaders or absentHeaders in expectedRequest, the tests fail. The logs show that only the default headers and the ones I explicitly send in the request are present—none of the headers I expect the filter to inject appear in the actual request:

	expected := http.ExpectedResponse{
					Request: request,
					ExpectedRequest: &http.ExpectedRequest{
						Request: http.Request{
							Protocol: "grpc",
							Host:     "echo:7070",
							Path:     "",
							Headers:  tc.expectedHeaders,
						},
						AbsentHeaders: tc.absentHeaders,
					},
					Namespace: "gateway-conformance-mesh",
				}

For example  - When testing for case for adding headers I am expecting to see the appended value but only see the headers i sent in the request.. 



        ID:
        Method:
        Protocol:         GRPC
        Alpn:
        URL:
        Version:
        Port:             7070
        Code:             200
        Host:             echo:7070
        Hostname:         echo-v2-7d46bf8884-xqttg
        Cluster:
        IP:               10.244.0.123
        Request Headers:  map[:[authority:echo:7070] Content-Type:[application/grpc] Some-Other-Header:[this-header-should-be-set] User-Agent:[grpc-go/1.58.3] X-Header-Add:[this-value-should-be-appended] X-Request-Id:[0]]
        Response Headers: map[Content-Type:[application/grpc]]

    pod.go:72: 2025-09-02T13:04:37.723607-07:00: Response expectation failed for request: [client grpc://echo:7070 -H Some-Other-Header:this-header-should-be-set -H X-Header-Add:this-value-should-be-appended]  not ready yet: expected X-Header-Add header to be set to this-value-should-be-appended,add-appends-values, got this-value-should-be-appended (after 29.208160166s)

So right now:

  • When I only check for success (200) and my original request headers, the tests pass.
  • When I also assert for the presence of headers modified/added by the RequestHeaderModifier, the tests fail.

I’m trying to understand whether this is a test expectation issue (e.g., I’m checking the wrong place for headers) or an implementation issue (e.g., the filter isn’t applying in Mesh mode).

This is the command I use to do the testing

go test -v ./conformance -run TestConformance/MeshGRPCRouteRequestHeaderModifier  -args --gateway-class=istio --supported-features=Mesh,GRPCRoute --allow-crds-mismatch=true

I have istio gateway and istiod in my installation to support both cases.

sa.choudhary@N9939CQ4P0 gateway-api % k get pods -n istio-system
NAME                                    READY   STATUS    RESTARTS   AGE
istio-ingressgateway-648978f9f8-nhb4x   1/1     Running   0          44h
istiod-54f5b9cfd-dc8t5                  1/1     Running   0          44h

@salonichf5 salonichf5 marked this pull request as ready for review September 2, 2025 20:29
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. release-note-none Denotes a PR that doesn't merit a release note. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add conformance test for GRPCRouteFilterRequestHeaderModifier
2 participants