Open
Conversation
|
other seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
This test is flakily fails. I run this test many times and it makes assertion fails. The failure message is as follows.
Failure:
Running com.alibaba.wasp.executor.TestExecutorService
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.249 sec <<< FAILURE!
testExecutorService(com.alibaba.wasp.executor.TestExecutorService) Time elapsed: 0.166 sec <<< FAILURE!
java.lang.AssertionError: expected:<10> but was:<5>
at org.junit.Assert.fail(Assert.java:93)
at org.junit.Assert.failNotEquals(Assert.java:647)
at org.junit.Assert.assertEquals(Assert.java:128)
at org.junit.Assert.assertEquals(Assert.java:472)
at org.junit.Assert.assertEquals(Assert.java:456)
at com.alibaba.wasp.executor.TestExecutorService.testExecutorService(TestExecutorService.java:109)
Results :
Failed tests:
TestExecutorService.testExecutorService:109 expected:<10> but was:<5>
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0
What changes were proposed in this pull request?
I observe a previous suggested fix injected some delay, but I believe that fix might be unstable in a CI environment or when run on different machines, given the dependency on some constant wait time. I suggest a new way to fix the test by adding some synchronization for the test execution only. I at first identify the code location whose slow execution leads to the flaky test failure, I found com/alibaba/wasp/executor/EventHandler.java#193 slows the execution makes assertion failure. Hence, I introduce one variable in this test class that is only there to provide some synchronization. Basically, until these statements are executed, I force the thread that runs the test to wait before it accesses the assertion values. The waiting location is at com/alibaba/wasp/executor/TestExecutorService.java#82.
Solution: I run the test many times and it makes the test pass always.