Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix test flakiness on MjpegScreenshotTest
I realized a bit too late that the tests I added were flaky when re-running the entire test suite: ` ./gradlew testServerDebugUnitTest --rerun-tasks` One of the tests would randomly (roughly 50% of the runs) fail with: ``` MjpegScreenshotTest > shouldNotBlockOnUnInitializedClient FAILED java.lang.AssertionError: expected:<200> but was:<-1> at org.junit.Assert.fail(Assert.java:89) at org.junit.Assert.failNotEquals(Assert.java:835) at org.junit.Assert.assertEquals(Assert.java:647) at org.junit.Assert.assertEquals(Assert.java:633) at io.appium.uiautomator2.server.mjpeg.MjpegScreenshotTest.shouldNotBlockOnUnInitializedClient(MjpegScreenshotTest.java:101) ``` After trying to understand what this meant: I realized I was not sending proper HTTP response, just some raw data on the socket. It's even worse than that as we send it as streaming: the client doesn't really get an ending response. There is no need to test that we can read a streaming response: just tweaking the mock data to send the proper header was enough to make the test reliable
- Loading branch information