goiri commented on a change in pull request #2406:
URL: https://github.com/apache/hadoop/pull/2406#discussion_r511489174



##########
File path: 
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestFileCreation.java
##########
@@ -273,10 +272,17 @@ public void testServerDefaultsWithMinimalCaching()
               defaults.getDefaultStoragePolicyId());
       doReturn(newDefaults).when(spyNamesystem).getServerDefaults();
 
-      Thread.sleep(1);
-      defaults = dfsClient.getServerDefaults();
-      // Value is updated correctly
-      assertEquals(updatedDefaultBlockSize, defaults.getBlockSize());
+      // Verify that the value is updated correctly
+      GenericTestUtils.waitFor(()->{
+        try {
+          FsServerDefaults currDef = dfsClient.getServerDefaults();
+          return (currDef.getBlockSize() == updatedDefaultBlockSize);
+        } catch (IOException e) {
+          // do nothing;
+          return false;
+        }
+      }, 1, 100);

Review comment:
       I think something like 1 second is reasonable.
   Taking into account that this extra time would only happen when the test 
fails, we would never see this.
   In this case I prefer to be conservative and handle corner cases.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to