You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@samza.apache.org by ca...@apache.org on 2019/10/10 17:44:02 UTC

[samza] branch master updated: SAMZA-2346: Fixing Test timeouts for Allocator testing (#1184)

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

cameronlee pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/samza.git


The following commit(s) were added to refs/heads/master by this push:
     new a3dd6fd  SAMZA-2346: Fixing Test timeouts for Allocator testing (#1184)
a3dd6fd is described below

commit a3dd6fd07166cc0a02c6b1401b3ab0d0386cd429
Author: Sanil Jain <sa...@gmail.com>
AuthorDate: Thu Oct 10 10:43:57 2019 -0700

    SAMZA-2346: Fixing Test timeouts for Allocator testing (#1184)
---
 .../TestContainerAllocatorWithHostAffinity.java            | 14 +++++++-------
 .../TestContainerAllocatorWithoutHostAffinity.java         |  2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/samza-core/src/test/java/org/apache/samza/clustermanager/TestContainerAllocatorWithHostAffinity.java b/samza-core/src/test/java/org/apache/samza/clustermanager/TestContainerAllocatorWithHostAffinity.java
index 6bc4e49..823191b 100644
--- a/samza-core/src/test/java/org/apache/samza/clustermanager/TestContainerAllocatorWithHostAffinity.java
+++ b/samza-core/src/test/java/org/apache/samza/clustermanager/TestContainerAllocatorWithHostAffinity.java
@@ -420,7 +420,7 @@ public class TestContainerAllocatorWithHostAffinity {
     spyAllocatorThread.start();
 
     // Let the request expire, expiration timeout is 3 ms
-    Thread.sleep(10);
+    Thread.sleep(100);
 
     // Verify that all the request that were created as preferred host requests expired
     assertTrue(state.preferredHostRequests.get() == 2);
@@ -456,8 +456,8 @@ public class TestContainerAllocatorWithHostAffinity {
     // Request Preferred Resources
     spyAllocator.requestResources(new HashMap<String, String>() {
       {
-        put("0", "abc");
-        put("1", "def");
+        put("0", "hostname-0");
+        put("1", "hostname-1");
       }
     });
 
@@ -466,13 +466,13 @@ public class TestContainerAllocatorWithHostAffinity {
     spyAllocatorThread.start();
 
     // Let the request expire, expiration timeout is 3 ms
-    Thread.sleep(10);
+    Thread.sleep(100);
 
     // Verify that all the request that were created as preferred host requests expired
-    assertTrue(state.expiredPreferredHostRequests.get() == 2);
-    verify(spyAllocator, times(1)).handleExpiredRequest(eq("0"), eq("abc"),
+    assertEquals(state.expiredPreferredHostRequests.get(), 2);
+    verify(spyAllocator, times(1)).handleExpiredRequest(eq("0"), eq("hostname-0"),
         any(SamzaResourceRequest.class));
-    verify(spyAllocator, times(1)).handleExpiredRequest(eq("1"), eq("def"),
+    verify(spyAllocator, times(1)).handleExpiredRequest(eq("1"), eq("hostname-1"),
         any(SamzaResourceRequest.class));
 
     // Verify that runStreamProcessor was invoked with already available ANY_HOST requests
diff --git a/samza-core/src/test/java/org/apache/samza/clustermanager/TestContainerAllocatorWithoutHostAffinity.java b/samza-core/src/test/java/org/apache/samza/clustermanager/TestContainerAllocatorWithoutHostAffinity.java
index bbccbcb..f30f800 100644
--- a/samza-core/src/test/java/org/apache/samza/clustermanager/TestContainerAllocatorWithoutHostAffinity.java
+++ b/samza-core/src/test/java/org/apache/samza/clustermanager/TestContainerAllocatorWithoutHostAffinity.java
@@ -312,7 +312,7 @@ public class TestContainerAllocatorWithoutHostAffinity {
     spyThread.start();
 
     // Let the request expire, expiration timeout is 3 ms
-    Thread.sleep(20);
+    Thread.sleep(100);
 
     // Verify that all the request that were created as ANY_HOST host
     // and all created requests expired