diff --git a/internal/controller/state/dataplane/convert_test.go b/internal/controller/state/dataplane/convert_test.go index 80ab70b2fe..55cbfbc835 100644 --- a/internal/controller/state/dataplane/convert_test.go +++ b/internal/controller/state/dataplane/convert_test.go @@ -380,6 +380,25 @@ func TestConvertHTTPMirrorFilter(t *testing.T) { }, name: "fraction result over 100", }, + { + filter: &v1.HTTPRequestMirrorFilter{ + BackendRef: v1.BackendObjectReference{ + Name: "backend", + Namespace: helpers.GetPointer[v1.Namespace]("namespace"), + }, + Fraction: &v1.Fraction{ + Numerator: 2, + Denominator: helpers.GetPointer(int32(2)), + }, + }, + expected: &HTTPRequestMirrorFilter{ + Name: helpers.GetPointer("backend"), + Namespace: helpers.GetPointer("namespace"), + Target: helpers.GetPointer("/_ngf-internal-mirror-namespace/backend-test/route1-0"), + Percent: helpers.GetPointer(float64(100)), + }, + name: "numerator equals denominator", + }, { filter: &v1.HTTPRequestMirrorFilter{ BackendRef: v1.BackendObjectReference{