-
Notifications
You must be signed in to change notification settings - Fork 188
flaky tests #120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Some tests are flaky due to the random seed. It's not clear whether the problem is the code or the test. These all need further investigation. Just fix the seed for now so that the tests pass. golang#120
Need to add a seed flag and plumb it through the tests. |
If there are tests that are still flaky after using new seeded random in testing comes through, update the flagged flaky methods to create a specific random Source to pass into the calls to random things e.g. r := rand.New(rand.NewSource(1)) |
This should always be considered a temporary workaround. Tests should pass with all possible seeds. |
Now, out of 1k runs, I see:
|
Remove TODO from tests that are no longer flaky. (Tested 1k times, see golang#120 (comment))
Remove TODO from tests that are no longer flaky. (Tested 1k times, see #120 (comment))
If I understand for iter := 0; iter < 1000; iter++ {
cell := CellFromCellID(randomCellID())
i1 := randomUniformInt(4) // i1 is a random conrer
i2 := (i1 + 1) & 3 // i2 is the next corner, counterclockwise
v1 := cell.Vertex(i1) // v1 is a random corner of the given cell
v2 := samplePointFromCap( // pick a random point in a cap
CapFromCenterAngle(cell.Vertex(i2), // centered at the second corner
s1.Angle(epsilon))) // with a radius of 1e-15
// if the corner is a right angle, there's a 25% chance that v2 is in the interior of the cell and a 75% chance it's outside
// v2 is within 0.0 and 1e-15 of the true vertex, with likelihood increasing proportional to the square of the radius
p := Interpolate(randomUniformFloat64(0, 1.0), v1, v2) // p is a random point between v1 and v2
// p could be outside cell by at most 1e-15, but that's larger than dblEpsilon of approx. 2.2e-16
if !CellFromCellID(
cellIDFromPoint(p) // this could be adjacent to cell, since p can be on or over the edge
).ContainsPoint(p) { // cellIdFromPoint says this should always be true
t.Errorf("For p=%v, CellFromCellID(cellIDFromPoint(p)).ContainsPoint(p) was false", p)
}
} Regardless of what |
Some tests are flaky due to use of randomness. Here are the failure counts for 1000 runs:
The text was updated successfully, but these errors were encountered: