From f4e4e33ed52151b61ca94c1c19083410df906cd8 Mon Sep 17 00:00:00 2001 From: Billy Schulze Date: Tue, 26 Nov 2024 18:20:42 +1100 Subject: [PATCH] Update HTTPRequestRedirectPolicy tests to use RedirectResponseCode Signed-off-by: Billy Schulze --- apis/projectcontour/v1/zz_generated.deepcopy.go | 2 +- internal/dag/builder_test.go | 8 ++++---- internal/dag/httpproxy_processor.go | 2 +- internal/featuretests/v3/redirectroutepolicy_test.go | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/apis/projectcontour/v1/zz_generated.deepcopy.go b/apis/projectcontour/v1/zz_generated.deepcopy.go index 3207fef641a..b3719ec6c39 100644 --- a/apis/projectcontour/v1/zz_generated.deepcopy.go +++ b/apis/projectcontour/v1/zz_generated.deepcopy.go @@ -516,7 +516,7 @@ func (in *HTTPRequestRedirectPolicy) DeepCopyInto(out *HTTPRequestRedirectPolicy } if in.StatusCode != nil { in, out := &in.StatusCode, &out.StatusCode - *out = new(int) + *out = new(RedirectResponseCode) **out = **in } if in.Path != nil { diff --git a/internal/dag/builder_test.go b/internal/dag/builder_test.go index 42048278367..6d0fa1011ee 100644 --- a/internal/dag/builder_test.go +++ b/internal/dag/builder_test.go @@ -12395,7 +12395,7 @@ func TestDAGInsert(t *testing.T) { Scheme: ptr.To("https"), Hostname: ptr.To("envoyproxy.io"), Port: ptr.To(int32(443)), - StatusCode: ptr.To(301), + StatusCode: ptr.To(contour_v1.RedirectResponseCode(301)), }, }}, }, @@ -12438,7 +12438,7 @@ func TestDAGInsert(t *testing.T) { Scheme: ptr.To("https"), Hostname: ptr.To("envoyproxy.io"), Port: ptr.To(int32(443)), - StatusCode: ptr.To(301), + StatusCode: ptr.To(contour_v1.RedirectResponseCode(301)), }, }}, }, @@ -12490,7 +12490,7 @@ func TestDAGInsert(t *testing.T) { Scheme: ptr.To("https"), Hostname: ptr.To("envoyproxy.io"), Port: ptr.To(int32(443)), - StatusCode: ptr.To(301), + StatusCode: ptr.To(contour_v1.RedirectResponseCode(301)), }, }}, }, @@ -12643,7 +12643,7 @@ func TestDAGInsert(t *testing.T) { Scheme: ptr.To("https"), Hostname: ptr.To("envoyproxy.io"), Port: ptr.To(int32(443)), - StatusCode: ptr.To(301), + StatusCode: ptr.To(contour_v1.RedirectResponseCode(301)), }, }, }, diff --git a/internal/dag/httpproxy_processor.go b/internal/dag/httpproxy_processor.go index f1d0741ab49..8a61bc5f132 100644 --- a/internal/dag/httpproxy_processor.go +++ b/internal/dag/httpproxy_processor.go @@ -1951,7 +1951,7 @@ func redirectRoutePolicy(redirect *contour_v1.HTTPRequestRedirectPolicy) (*Redir var statusCode int if redirect.StatusCode != nil { - statusCode = *redirect.StatusCode + statusCode = int(*redirect.StatusCode) } if redirect.Path != nil && redirect.Prefix != nil { diff --git a/internal/featuretests/v3/redirectroutepolicy_test.go b/internal/featuretests/v3/redirectroutepolicy_test.go index 5a7bc7645e1..4a2c3e0f889 100644 --- a/internal/featuretests/v3/redirectroutepolicy_test.go +++ b/internal/featuretests/v3/redirectroutepolicy_test.go @@ -43,7 +43,7 @@ func TestRedirectResponsePolicy_HTTProxy(t *testing.T) { Scheme: ptr.To("https"), Hostname: ptr.To("envoyproxy.io"), Port: ptr.To(int32(443)), - StatusCode: ptr.To(301), + StatusCode: ptr.To(contour_v1.RedirectResponseCode(301)), Path: ptr.To("/blog"), }, }}, @@ -87,7 +87,7 @@ func TestRedirectResponsePolicy_HTTProxy(t *testing.T) { Scheme: ptr.To("https"), Hostname: ptr.To("envoyproxy.io"), Port: ptr.To(int32(443)), - StatusCode: ptr.To(301), + StatusCode: ptr.To(contour_v1.RedirectResponseCode(301)), Prefix: ptr.To("/blogprefix"), }, }}, @@ -135,7 +135,7 @@ func TestRedirectResponsePolicy_HTTProxy(t *testing.T) { Scheme: ptr.To("https"), Hostname: ptr.To("envoyproxy.io"), Port: ptr.To(int32(443)), - StatusCode: ptr.To(301), + StatusCode: ptr.To(contour_v1.RedirectResponseCode(301)), Prefix: ptr.To("/blogprefix"), Path: ptr.To("/blogprefix"), },