Skip to content

Commit

Permalink
before template creation tests for mirror
Browse files Browse the repository at this point in the history
Signed-off-by: Amit Mor <[email protected]>
  • Loading branch information
amimimor committed Apr 3, 2024
1 parent e1e9762 commit 6b65d2f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
7 changes: 5 additions & 2 deletions internal/mode/static/nginx/config/servers.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,12 @@ func updateLocationsForFilters(
return buildLocations
}

if filters.RequestMirror != nil {
filtersRequestMirror := filters.RequestMirror
if filtersRequestMirror != nil {
for i := range buildLocations {
buildLocations[i].MirrorPath = *filters.RequestMirror.Target
if filtersRequestMirror.Target != nil {
buildLocations[i].MirrorPath = *filtersRequestMirror.Target
}
}
}

Expand Down
5 changes: 3 additions & 2 deletions internal/mode/static/nginx/config/servers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,6 @@ func TestCreateServerWithMirrors(t *testing.T) {
},
},
},
// addition
{
Path: "/mirroring",
PathType: dataplane.PathTypePrefix,
Expand All @@ -898,7 +897,7 @@ func TestCreateServerWithMirrors(t *testing.T) {
RequestMirror: &dataplane.HTTPRequestMirrorFilter{
Namespace: helpers.GetPointer("cafe.example.com"),
Port: helpers.GetPointer(int32(8080)),
Scheme: helpers.GetPointer("http"),
Target: helpers.GetPointer("/cafe.example.com-mirroring-mirror"),
},
},
BackendGroup: fooGroup,
Expand Down Expand Up @@ -953,11 +952,13 @@ func TestCreateServerWithMirrors(t *testing.T) {
Path: "/mirroring/",
ProxySetHeaders: defaultSetHeader,
ProxyPass: "http://$test__route1_rule0$request_uri",
MirrorPath: "/cafe.example.com-mirroring-mirror",
},
{
Path: "= /mirroring",
ProxySetHeaders: defaultSetHeader,
ProxyPass: "http://$test__route1_rule0$request_uri",
MirrorPath: "/cafe.example.com-mirroring-mirror",
},
{
Path: "/mirroring_mirror/",
Expand Down

0 comments on commit 6b65d2f

Please sign in to comment.