You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by sn...@apache.org on 2021/07/28 15:15:57 UTC

[hadoop] branch branch-3.1 updated: YARN-9551. TestTimelineClientV2Impl.testSyncCall fails intermittent (#3212)

This is an automated email from the ASF dual-hosted git repository.

snemeth pushed a commit to branch branch-3.1
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/branch-3.1 by this push:
     new 3f14a9b  YARN-9551. TestTimelineClientV2Impl.testSyncCall fails intermittent (#3212)
3f14a9b is described below

commit 3f14a9b21f9aead9a2d14a3bcd966a375301ba2f
Author: 9uapaw <gy...@gmail.com>
AuthorDate: Wed Jul 28 04:35:20 2021 +0200

    YARN-9551. TestTimelineClientV2Impl.testSyncCall fails intermittent (#3212)
    
    Co-authored-by: Andras Gyori <ga...@cloudera.com>
    (cherry picked from commit b4a524722a2466ede935aefd7b24a1e08fdbf076)
    (cherry picked from commit f001595b47ae9f60cc2ca13676d9daf3baff9963)
    (cherry picked from commit 1dc343726c0910141cc156b5e3f58d248a8a67c5)
---
 .../client/api/impl/TestTimelineClientV2Impl.java  | 36 ++++++++++++++--------
 1 file changed, 24 insertions(+), 12 deletions(-)

diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/client/api/impl/TestTimelineClientV2Impl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/client/api/impl/TestTimelineClientV2Impl.java
index 95595a9..95381a8 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/client/api/impl/TestTimelineClientV2Impl.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/client/api/impl/TestTimelineClientV2Impl.java
@@ -248,24 +248,36 @@ public class TestTimelineClientV2Impl {
       Thread.sleep(TIME_TO_SLEEP);
     }
     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);
     Assert.assertEquals("sync entities should not be merged with async", 1,
         firstPublishedEntities.getEntities().size());
 
-    // test before pushing the sync entities asyncs are merged and pushed
-    TimelineEntities secondPublishedEntities = client.getPublishedEntities(1);
-    Assert.assertEquals(
-        "async entities should be merged before publishing sync", 2,
-        secondPublishedEntities.getEntities().size());
-    Assert.assertEquals("Order of Async Events Needs to be FIFO", "2",
-        secondPublishedEntities.getEntities().get(0).getId());
-    Assert.assertEquals("Order of Async Events Needs to be FIFO", "3",
-        secondPublishedEntities.getEntities().get(1).getId());
+    // async push does not guarantee a merge but is FIFO
+    if (asyncPushesMerged) {
+      TimelineEntities secondPublishedEntities = client.getPublishedEntities(1);
+      Assert.assertEquals(
+          "async entities should be merged before publishing sync", 2,
+          secondPublishedEntities.getEntities().size());
+      Assert.assertEquals("Order of Async Events Needs to be FIFO", "2",
+          secondPublishedEntities.getEntities().get(0).getId());
+      Assert.assertEquals("Order of Async Events Needs to be FIFO", "3",
+          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
-    TimelineEntities thirdPublishedEntities = client.getPublishedEntities(2);
+    TimelineEntities thirdPublishedEntities =
+        client.getPublishedEntities(lastPublishIndex);
     Assert.assertEquals("sync entities had to be published at the last", 1,
         thirdPublishedEntities.getEntities().size());
     Assert.assertEquals("Expected last sync Event is not proper", "4",

---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org