Skip to content

TestRectCentroidFullRange is flaky #254

@jmr

Description

@jmr
=== RUN   TestRectCentroidFullRange
    rect_test.go:1169: [Lo[-90.0000000, -179.9087477], Hi[90.0000000, 179.9087477]].Centroid() - [Lo[-90.0000000, -179.9087477], Hi[90.0000000, -80.4477068]].Centroid() - [Lo[-90.0000000, -80.4477068], Hi[90.0000000, 179.9087477]].Centroid = 1.3322676295501878e-15, want ~0
    rect_test.go:1169: [Lo[-90.0000000, -80.4477068], Hi[90.0000000, 179.9087477]].Centroid() - [Lo[-90.0000000, -80.4477068], Hi[90.0000000, 14.2723948]].Centroid() - [Lo[-90.0000000, 14.2723948], Hi[90.0000000, 179.9087477]].Centroid = 1.0778315928076987e-15, want ~0
--- FAIL: TestRectCentroidFullRange (0.00s)

https://github.com/golang/geo/actions/runs/20675221001/job/59694965751?pr=253#step:5:1032

This was in the context of a PR, but I don't think anything relevant was changed. The number of iterations should be bumped up to try to reproduce this.

geo/s2/rect_test.go

Lines 1168 to 1169 in fd65259

if got, want := r.Centroid().Sub(child0.Centroid().Vector).Sub(child1.Centroid().Vector).Norm(), 1e-15; got > want {
t.Errorf("%v.Centroid() - %v.Centroid() - %v.Centroid = %v, want ~0", r, child0, child1, got)

Ah. In C++ the threshold was increased to reduce the flakiness.

https://github.com/google/s2geometry/blob/ac448e2e939863dfefdeb6500ea74fda92d8187c/src/s2/s2latlng_rect_test.cc#L646

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions