YARN-9551. TestTimelineClientV2Impl.testSyncCall fails intermittent (#3212)
Co-authored-by: Andras Gyori <gandras@cloudera.com>
This commit is contained in:
parent
ae20516ebc
commit
b4a524722a
@ -248,13 +248,16 @@ public void testSyncCall() throws Exception {
|
|||||||
Thread.sleep(TIME_TO_SLEEP);
|
Thread.sleep(TIME_TO_SLEEP);
|
||||||
}
|
}
|
||||||
printReceivedEntities();
|
printReceivedEntities();
|
||||||
Assert.assertEquals("TimelineEntities not published as desired", 3,
|
|
||||||
client.getNumOfTimelineEntitiesPublished());
|
boolean asyncPushesMerged = client.getNumOfTimelineEntitiesPublished() == 3;
|
||||||
|
int lastPublishIndex = asyncPushesMerged ? 2 : 3;
|
||||||
|
|
||||||
TimelineEntities firstPublishedEntities = client.getPublishedEntities(0);
|
TimelineEntities firstPublishedEntities = client.getPublishedEntities(0);
|
||||||
Assert.assertEquals("sync entities should not be merged with async", 1,
|
Assert.assertEquals("sync entities should not be merged with async", 1,
|
||||||
firstPublishedEntities.getEntities().size());
|
firstPublishedEntities.getEntities().size());
|
||||||
|
|
||||||
// test before pushing the sync entities asyncs are merged and pushed
|
// async push does not guarantee a merge but is FIFO
|
||||||
|
if (asyncPushesMerged) {
|
||||||
TimelineEntities secondPublishedEntities = client.getPublishedEntities(1);
|
TimelineEntities secondPublishedEntities = client.getPublishedEntities(1);
|
||||||
Assert.assertEquals(
|
Assert.assertEquals(
|
||||||
"async entities should be merged before publishing sync", 2,
|
"async entities should be merged before publishing sync", 2,
|
||||||
@ -263,9 +266,18 @@ public void testSyncCall() throws Exception {
|
|||||||
secondPublishedEntities.getEntities().get(0).getId());
|
secondPublishedEntities.getEntities().get(0).getId());
|
||||||
Assert.assertEquals("Order of Async Events Needs to be FIFO", "3",
|
Assert.assertEquals("Order of Async Events Needs to be FIFO", "3",
|
||||||
secondPublishedEntities.getEntities().get(1).getId());
|
secondPublishedEntities.getEntities().get(1).getId());
|
||||||
|
} else {
|
||||||
|
TimelineEntities secondAsyncPublish = client.getPublishedEntities(1);
|
||||||
|
Assert.assertEquals("Order of Async Events Needs to be FIFO", "2",
|
||||||
|
secondAsyncPublish.getEntities().get(0).getId());
|
||||||
|
TimelineEntities thirdAsyncPublish = client.getPublishedEntities(2);
|
||||||
|
Assert.assertEquals("Order of Async Events Needs to be FIFO", "3",
|
||||||
|
thirdAsyncPublish.getEntities().get(0).getId());
|
||||||
|
}
|
||||||
|
|
||||||
// test the last entity published is sync put
|
// test the last entity published is sync put
|
||||||
TimelineEntities thirdPublishedEntities = client.getPublishedEntities(2);
|
TimelineEntities thirdPublishedEntities =
|
||||||
|
client.getPublishedEntities(lastPublishIndex);
|
||||||
Assert.assertEquals("sync entities had to be published at the last", 1,
|
Assert.assertEquals("sync entities had to be published at the last", 1,
|
||||||
thirdPublishedEntities.getEntities().size());
|
thirdPublishedEntities.getEntities().size());
|
||||||
Assert.assertEquals("Expected last sync Event is not proper", "4",
|
Assert.assertEquals("Expected last sync Event is not proper", "4",
|
||||||
|
Loading…
Reference in New Issue
Block a user