flame-engine/flame

Flaky random test for specific seed

Closed this issue · 3 comments

What happened?

As discovered by @gnarhard on #3647, the Transform2D#random test has a precision failure specifically for the seed 2021996283 (possibly others but have not been able to reproduce locally with any other seed).

This is clearly a precision issue that can be easily fixed by increasing the delta, though I will conduct a slightly thorougher investigation, while @gnarhard can go buy his winning lottery ticket.

❌ /home/runner/work/flame/flame/packages/flame/test/game/transform2d_test.dart: Transform2D random [seed=2021996283] (failed)
  Expected: a Vector2 object within 0.00001721491496360162 of (2.0070884227752686, 2.1730268001556396)
    Actual: Vector2:<[2.007079839706421,2.173011302947998]>
     Which: is at distance 0.00001771531866861336
  
  package:matcher                                expect
  test/game/transform2d_test.dart 255:9          main.<fn>.<fn>
  package:flame_test/src/random_test.dart 50:17  testRandom.<fn>

What do you expect?

The test not to fail for any seed.

How can we reproduce this?

No response

What steps should take to fix this?

No response

Do have an example of where the bug occurs?

Running the test locally for the 2021996283 seed consistently fails.

Relevant log output

❌ /home/runner/work/flame/flame/packages/flame/test/game/transform2d_test.dart: Transform2D random [seed=2021996283] (failed)
  Expected: a Vector2 object within 0.00001721491496360162 of (2.0070884227752686, 2.1730268001556396)
    Actual: Vector2:<[2.007079839706421,2.173011302947998]>
     Which: is at distance 0.00001771531866861336
  
  package:matcher                                expect
  test/game/transform2d_test.dart 255:9          main.<fn>.<fn>
  package:flame_test/src/random_test.dart 50:17  testRandom.<fn>

Execute in a terminal and put output into the code block below

No response

Affected platforms

All

Other information

No response

Are you interested in working on a PR for this?

  • I want to work on this

@zeyus since you've been heavily involved in the tolerances on these tests, maybe you could give some input? :)

@spydon No probs, it will have to wait until Thursday if that's ok because I have to demo something Wednesday and I am so far from being ready haha

@zeyus haha understandable, no rush! 😊