-
Notifications
You must be signed in to change notification settings - Fork 371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix flickering and improve speed in EventsTest #589
Conversation
@@ -55,7 +58,7 @@ public class EventsTest { | |||
|
|||
@BeforeClass | |||
public static void setupDelay() { | |||
GitHubSCMSource.setEventDelaySeconds(1); | |||
GitHubSCMSource.setEventDelaySeconds(0); // fire immediately without delay |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO do not make much sense to add 1 second per each test for a delay. With that change single test runs 20-30 ms instead of 1200 ms.
SCMEvents.awaitOne(watermark, received ? 20 : 200, TimeUnit.MILLISECONDS); | ||
|
||
if (received) { | ||
TestSCMEventListener.awaitUntilReceived(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
usually event comes immediately, but if system struggling from not enough resources it could be longer, so let's add a waiter for event to be received for tests which are expecting received = true
@@ -188,7 +191,11 @@ private GHSubscriberEvent createEvent(String eventPayloadFile) throws IOExceptio | |||
private void waitAndAssertReceived(boolean received) throws InterruptedException { | |||
long watermark = SCMEvents.getWatermark(); | |||
// event will be fired by subscriber at some point | |||
SCMEvents.awaitOne(watermark, 1200, TimeUnit.MILLISECONDS); | |||
SCMEvents.awaitOne(watermark, received ? 20 : 200, TimeUnit.MILLISECONDS); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before changes await was 1200 because of delay before test was 1 second, for now we leave 200 millis for cases when expected received = false
Could someone from maintainers please review? |
Description
EventsTest was flickering because on high load system wait was finishing before event comes.
Submitter checklist
Reviewer checklist
Documentation changes
Users/aliases to notify