Incorrect discovery callback handling leads to sporadic tests failures
We are starting to see a lot more pipeline failures, especially for win64. This seems to be due to an incorrect handling of the discovery progress, especially when there are more than a single entry point being queued.
Most likely this happened when we split discovery tasks in 2 (!386 (merged)) which causes the following sequence to occur:
- discover( entrypoint 1 )
- onEntryPointAdded( entrypoint 1 )
- onDiscoveryStarted( entrypoint 1 )
- discover( entrypoint 2 )
- onDiscoveryCompleted( entrypoint 1 ) // Since the first discovery is interrupted to add the 2nd entrypoint
- onEntryPointAdded( entrypoint 2 )
- onDiscoveryStarted( entrypoint 1 )
- onDiscoveryCompleted( entrypoint 1 ) // Now it actually finished, but since we expected only 2 discoveries, we consider the discovery to be fully completed, which is false
- onDiscoveryStarted( entrypoint 2 )
- onDiscoveryCompleted( entrypoint 2 )