DeepBlueRobotics / lib199

Code that we reuse in different projects/years.
Other
2 stars 0 forks source link

Reduce `MockedCANCoderTest` Fail Rate #82

Closed CoolSpy3 closed 2 months ago

CoolSpy3 commented 2 months ago

I was running into a bug where MockedCANCoderTest was failing semi-regularly. This PR introduces three additional waits to reduce this occurrence. I tried a couple configurations.

Adding a check after setting the position to 0 and performing two waits before each check seemed to be the best combination of functionality and clarity.

(Note: From my testing, it was not clear that increasing the timeout parameter or changing the location of the wait calls had a significant effect on the failure rate.)

Original Failure Rate: 18/100 (The denominator is not a typo. This number is from a test 10x smaller than the others.) Failure rate after adding wait on line 34: 38/1000 Failure after adding waits on lines 34 and 44: 1/1000 Failure after adding waits on lines 34, 44, and 35: 2/1000

These last two results both have a <1% failure rate, so they are basically identical. I kept the extra wait in because it's clearer just to perform two waits before reading any data. I tried to run some more detailed tests on them, but they didn't return reasonable results.

CoolSpy3 commented 2 months ago

Agreed :+1:

Closing as resolved by #83.