Skip to content

Commit

Permalink
replace multi-mirror test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
LiorLieberman committed Dec 18, 2024
1 parent 15db255 commit 63803d9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 23 deletions.
20 changes: 5 additions & 15 deletions conformance/tests/httproute-request-percentage-mirror.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import (

const (
concurrentRequests = 10
tolerancePercentage = 15.0
tolerancePercentage = 5.0
totalRequests = 500.0
numDistributionChecks = 5
)
Expand All @@ -54,7 +54,7 @@ var HTTPRouteRequestPercentageMirror = suite.ConformanceTest{
Features: []features.FeatureName{
features.SupportGateway,
features.SupportHTTPRoute,
features.SupportHTTPRouteRequestPercentageMirror,
// features.SupportHTTPRouteRequestPercentageMirror,
},
Test: func(t *testing.T, suite *suite.ConformanceTestSuite) {
var (
Expand All @@ -66,7 +66,6 @@ var HTTPRouteRequestPercentageMirror = suite.ConformanceTest{

kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN)

// TODO(liorlieberman) add another test to show fraction takes precedence over percent
testCases := []http.ExpectedResponse{
{
Request: http.Request{Path: "/percent-mirror"},
Expand Down Expand Up @@ -101,20 +100,20 @@ var HTTPRouteRequestPercentageMirror = suite.ConformanceTest{
Name: "infra-backend-v2",
Namespace: ns,
},
Percent: ptrTo(int32(50)), // 1000/2000
Percent: ptrTo(int32(50)),
},
},
}, {
Request: http.Request{
Path: "/percent-multi-mirror-and-modify-headers",
Path: "/percent-mirror-and-modify-headers",
Headers: map[string]string{
"X-Header-Remove": "remove-val",
"X-Header-Add-Append": "append-val-1",
},
},
ExpectedRequest: &http.ExpectedRequest{
Request: http.Request{
Path: "/percent-multi-mirror-and-modify-headers",
Path: "/percent-mirror-and-modify-headers",
Headers: map[string]string{
"X-Header-Add": "header-val-1",
"X-Header-Add-Append": "append-val-1,header-val-2",
Expand All @@ -133,20 +132,11 @@ var HTTPRouteRequestPercentageMirror = suite.ConformanceTest{
},
Percent: ptrTo(int32(35)),
},
{
BackendRef: http.BackendRef{
Name: "infra-backend-v3",
Namespace: ns,
},
Percent: ptrTo(int32(50)),
},
},
},
}

for i := range testCases {
// Declare tc here to avoid loop variable
// reuse issues across parallel tests.
expected := testCases[i]
t.Run(expected.GetTestCaseName(i), func(t *testing.T) {
// Assert request succeeds before doing our distribution check
Expand Down
9 changes: 1 addition & 8 deletions conformance/tests/httproute-request-percentage-mirror.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ spec:
- matches:
- path:
type: PathPrefix
value: /percent-multi-mirror-and-modify-headers
value: /percent-mirror-and-modify-headers
filters:
- type: RequestHeaderModifier
requestHeaderModifier:
Expand All @@ -65,13 +65,6 @@ spec:
namespace: gateway-conformance-infra
port: 8080
percent: 35
- type: RequestMirror
requestMirror:
backendRef:
name: infra-backend-v3
namespace: gateway-conformance-infra
port: 8080
percent: 50
backendRefs:
- name: infra-backend-v1
port: 8080
Expand Down

0 comments on commit 63803d9

Please sign in to comment.