Repository navigation
test: fix the flaky RtpListenerTest and JieliTest (#257) - #259
Conversation
RtpListenerTest read the status and payload-type lists with Collections.frequency() and for-each while the session thread added to them; a synchronizedList does not guard iteration, hence the ConcurrentModificationException. The recorder now uses CopyOnWriteArrayList. JieliTest kept the diagnostic port for diagnosticMs = 500, so the port lived about a second (until the next receive timeout); a pause of more than that on a loaded runner before the test sent its packet lost it and failed assertNotNull(d) at line 825 (reproduced with a 1.2 s pause). The port now lives 3 s and the test waits up to 6 s for it to be freed.
PR Summary by QodoStabilize RTP listener and Jieli diagnostic tests
AI Description
Diagram
High-Level Assessment
Files changed (2)
|
Code Review by Qodo
1.
|
|
/review |
|
Code review by qodo was updated up to the latest commit fd1e71b |
Closes #257. Tests only: no app change, no version bump.
RtpListenerTest.silenceIsReportedWithoutRebinding
Recorder.statuses/sdps/ptswereCollections.synchronizedList, but the test reads them withCollections.frequency()and for-each while the session thread adds to them; iteration is not guarded by a synchronized list, hence theConcurrentModificationExceptionat line 288 on CI. They areCopyOnWriteArrayListnow. The other tests that use synchronized lists only callcontains/get/copy (guarded), so they are left as they are.JieliTest.noVideoListensElsewhereAndAsksAgain
The test set
diagnosticMs = 500. The client closes a diagnostic port at the first receive timeout (1 s) after that, so the port lived about a second. The test waits for the no-video state (20 ms polls), sleeps 100 ms and only then sends its packet; a pause longer than that second on a loaded runner lost the packet and failedassertNotNull(d)at line 825.Reproduced locally by putting a 1.2 s pause before the send: the same failure at line 825 (0.7 s did not fail). With
diagnosticMs = 3000and up to 6 s to wait for the port to be freed, the 1.2 s pause passes. The probe is not part of the change.Checked
testDebugUnitTest,lintDebug.