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.
What changes were proposed in this pull request?
I observe that a test (info.archinnov.achilles.it.TestALLEntityAsChild.should_insert) is a flaky test than can fail due to the slow execution of achilles-embedded/src/main/java/info/archinnov/achilles/embedded/ServerStarter#L159. When ServerStarter.java#159 is not executed quick enough, the method (initializeFromParameters) tries to connect the cluster given at Line 63, then fails. While it may be possible to fix this flaky test by adding a waiting time before the execution of this line, but I believe such a fix might be unstable in a CI environment or when run on different machines, given the dependency on some constant wait time. Hence, 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 that needs to be executed before making the connection with the cluster (achilles-embedded/src/main/java/info/archinnov/achilles/embedded/ServerStarter#L159), so I introduce one variable in this class that is only there to provide some synchronization. Basically, until these statements are executed, I force the thread that the test runs to wait before it proceeds to the assertions.
Why are the changes needed?
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 30.377 s <<< FAILURE! - in info.archinnov.achilles.it.TestALLEntityAsChild
[ERROR] should_insert(info.archinnov.achilles.it.TestALLEntityAsChild) Time elapsed: 30.377 s <<< ERROR!
com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: localhost/127.0.0.1:9042 (com.datastax.driver.core.exceptions.TransportException: [localhost/127.0.0.1:9042] Cannot connect))
at info.archinnov.achilles.it.TestALLEntityAsChild.(TestALLEntityAsChild.java:49)
[INFO]
[INFO] Results:
[INFO]
[ERROR] Errors:
[ERROR] TestALLEntityAsChild.:49 » NoHostAvailable All host(s) tried for query f...
[INFO]
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
How was this patch tested?
I run this test more than 1000 times and the test always passes.