diff --git a/pkg/geo/bbox_test.go b/pkg/geo/bbox_test.go index 6220ecc76ef1..e8547f4d8ac8 100644 --- a/pkg/geo/bbox_test.go +++ b/pkg/geo/bbox_test.go @@ -12,6 +12,7 @@ package geo import ( "fmt" + "math" "strconv" "testing" @@ -184,6 +185,22 @@ func TestBoundingBoxFromGeomT(t *testing.T) { t.Run(fmt.Sprintf("%s: %#v", tc.soType, tc.g), func(t *testing.T) { bbox, err := boundingBoxFromGeomT(tc.g, tc.soType) require.NoError(t, err) + // If bbox is within a small epsilon of expected, use the same values. + if bbox != nil && tc.expected != nil { + const epsilon = 0.000001 + if math.Abs(bbox.LoX-tc.expected.LoX) < epsilon { + bbox.LoX = tc.expected.LoX + } + if math.Abs(bbox.HiX-tc.expected.HiX) < epsilon { + bbox.HiX = tc.expected.HiX + } + if math.Abs(bbox.LoY-tc.expected.LoY) < epsilon { + bbox.LoY = tc.expected.LoY + } + if math.Abs(bbox.HiY-tc.expected.HiY) < epsilon { + bbox.HiY = tc.expected.HiY + } + } require.Equal(t, tc.expected, bbox) }) }