generated from kubernetes/kubernetes-template-project
-
Notifications
You must be signed in to change notification settings - Fork 618
Closed
Labels
area/conformance-testIssues or PRs related to Conformance tests.Issues or PRs related to Conformance tests.kind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.
Description
What happened:
The test names for HTTP Header Matching in particular are not very helpful. For example, here's the output from one test run:
--- PASS: TestConformance/HTTPRouteHeaderMatching/9_request_to_/_with_headers_should_go_to_ (0.07s)
--- PASS: TestConformance/HTTPRouteHeaderMatching/4_request_to_/_with_headers_should_go_to_ (0.07s)
--- PASS: TestConformance/HTTPRouteHeaderMatching/3_request_to_/_with_headers_should_go_to_ (0.08s)
--- FAIL: TestConformance/HTTPRouteHeaderMatching/5_request_to_/_with_headers_should_go_to_infra-backend-v1 (30.00s)
--- FAIL: TestConformance/HTTPRouteHeaderMatching/8_request_to_/_with_headers_should_go_to_infra-backend-v2 (30.00s)
--- FAIL: TestConformance/HTTPRouteHeaderMatching/0_request_to_/_with_headers_should_go_to_infra-backend-v1 (30.00s)
--- FAIL: TestConformance/HTTPRouteHeaderMatching/6_request_to_/_with_headers_should_go_to_infra-backend-v1 (30.00s)
--- FAIL: TestConformance/HTTPRouteHeaderMatching/7_request_to_/_with_headers_should_go_to_infra-backend-v2 (30.00s)
--- FAIL: TestConformance/HTTPRouteHeaderMatching/2_request_to_/_with_headers_should_go_to_infra-backend-v1 (30.00s)
--- FAIL: TestConformance/HTTPRouteHeaderMatching/1_request_to_/_with_headers_should_go_to_infra-backend-v2 (30.00s)
What you expected to happen:
Test names to make sense.
How to reproduce it (as minimally and precisely as possible):
Run conformance tests.
Anything else we need to know?:
I think there are at least two fundamental problems here:
- When Backend is nil we should look to see if a status code has been specified and use that instead: https://github.com/kubernetes-sigs/gateway-api/blob/main/conformance/tests/httproute-header-matching.go#L57
- We probably want to find a better way to represent "/" in our test case names. As it is, it looks like "2_request_to_" has a subtest named "_with_headers_should_go_to_infra-backend-v1". I'm not sure what the best solution is here, but the following steps could provide some improvement here:
A. Remove the first "/" character from paths, replace the rest with another character such as "_"
B. Update test cases to be able to optionally specify their own test name. When specified, it would be used instead of the generated one.
For reference, our current testName function is here:
gateway-api/conformance/tests/httproute-matching-across-routes.go
Lines 118 to 125 in 9537337
| func testName(tc http.ExpectedResponse, i int) string { | |
| headerStr := "" | |
| if tc.Request.Headers != nil { | |
| headerStr = " with headers" | |
| } | |
| return fmt.Sprintf("%d request to %s%s%s should go to %s", i, tc.Request.Host, tc.Request.Path, headerStr, tc.Backend) | |
| } |
In addition to the updates suggested above, it should likely be moved to some kind of more clearly shared utils/helpers file as part of these updates.
Metadata
Metadata
Assignees
Labels
area/conformance-testIssues or PRs related to Conformance tests.Issues or PRs related to Conformance tests.kind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.