wpilibsuite / allwpilib

Official Repository of WPILibJ and WPILibC
https://wpilib.org/
Other
1.05k stars 611 forks source link

ArmSimulation test is flaky #5908

Open calcmogul opened 9 months ago

calcmogul commented 9 months ago
[----------] 3 tests from ArmSimulationTests/ArmSimulationTest
[ RUN      ] ArmSimulationTests/ArmSimulationTest.Teleop/75deg
Not loading CameraServerShared
NT: Listening on NT3 port 1735, NT4 port 5810

********** Robot program startup complete **********
/home/tav/frc/wpilib/allwpilib/wpilibcExamples/src/test/cpp/examples/ArmSimulation/cpp/ArmSimulationTest.cpp:53: Failure
Expected equality of these values:
  kDefaultArmSetpoint.value()
    Which is: 75
  frc::Preferences::GetDouble(kArmPositionKey, (__builtin_nanf ("")))
    Which is: 50

Default RobotPeriodic() method... Override me!
Default DisabledPeriodic() method... Override me!
[  FAILED  ] ArmSimulationTests/ArmSimulationTest.Teleop/75deg, where GetParam() = 8-byte object <00-00 00-00 00-C0 52-40> (107 ms)

The arm simulation tests haven't changed, so maybe it's a race condition in NT the test was relying on turning out a certain way?

narmstro2020 commented 9 months ago

I've noticed this too. Though my numbers are 75 and 25.

Just a note for anyone else running into this. If running a local build for testing on a completely unrelated piece of code. I commented out the line. ran the build and before committing uncommented the line back in.

Starlight220 commented 8 months ago

I suspect this is an issue with resetting preferences not being properly reset between test cases, and not in the example itself.