How do I know if 2 threads are running concurrently? #3102
Unanswered
krmahadevan
asked this question in
Internal Dev Discussions
Replies: 1 comment
-
The test is a performance test. Instead you can find where the time is wasting and try to improve it. Both options are valid and have to make this choice everytime a performance test is failing. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
There are some tests within the TestNG codebase that try to test if test methods were started concurrently by TestNG.
Sample failure: https://github.com/testng-team/testng/actions/runs/8391184326/job/22980937095?pr=3100
Failing test details from gradle build scan: https://scans.gradle.com/s/m4kgqbuhsc4xo/tests/task/:testng-core:test/details/test.factory.issue326.IssueTest/testToCheckParallelExecutionOfInstancesWithOneThreadPerInstance?top-execution=1
Error details:
The failing test: https://github.com/testng-team/testng/blob/master/testng-core/src/test/java/test/factory/issue326/IssueTest.java#L16
The piece of code that is causing the flakiness
The test is trying to basically ascertain if 2 test methods started at the same time. The logic that's included in the test works most of the time, but the moment the JVM gets stressed out, it becomes flaky 🤦
@juherr @vlsi - Any suggestions on how to modify the test and ensure it gets to pass all the time? Should I bump up the expected tolerance value from 1,000 ms to say 5,000 ms (i.e., the test would then check if the 2 concurrent test methods had a start time diff of max 5 seconds). I am not able to think of any other way. I think there maybe more such flaky tests which are going to keep failing randomly whenever the JVM gets run with the above flags.
Beta Was this translation helpful? Give feedback.
All reactions