HDFS-15460. TestFileCreation#testServerDefaultsWithMinimalCaching fails intermittently. (#2406)
This commit is contained in:
parent
98097b8f19
commit
d0c786db4d
@ -239,9 +239,8 @@ public void testServerDefaultsWithCaching()
|
|||||||
* Test that server defaults are updated on the client after cache expiration.
|
* Test that server defaults are updated on the client after cache expiration.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testServerDefaultsWithMinimalCaching()
|
public void testServerDefaultsWithMinimalCaching() throws Exception {
|
||||||
throws IOException, InterruptedException {
|
// Create cluster with an explicit block size param.
|
||||||
// Create cluster with an explicit block size param
|
|
||||||
Configuration clusterConf = new HdfsConfiguration();
|
Configuration clusterConf = new HdfsConfiguration();
|
||||||
long originalBlockSize = DFS_BLOCK_SIZE_DEFAULT * 2;
|
long originalBlockSize = DFS_BLOCK_SIZE_DEFAULT * 2;
|
||||||
clusterConf.setLong(DFS_BLOCK_SIZE_KEY, originalBlockSize);
|
clusterConf.setLong(DFS_BLOCK_SIZE_KEY, originalBlockSize);
|
||||||
@ -273,10 +272,17 @@ public void testServerDefaultsWithMinimalCaching()
|
|||||||
defaults.getDefaultStoragePolicyId());
|
defaults.getDefaultStoragePolicyId());
|
||||||
doReturn(newDefaults).when(spyNamesystem).getServerDefaults();
|
doReturn(newDefaults).when(spyNamesystem).getServerDefaults();
|
||||||
|
|
||||||
Thread.sleep(1);
|
// Verify that the value is updated correctly. Wait for 3 seconds.
|
||||||
defaults = dfsClient.getServerDefaults();
|
GenericTestUtils.waitFor(()->{
|
||||||
// Value is updated correctly
|
try {
|
||||||
assertEquals(updatedDefaultBlockSize, defaults.getBlockSize());
|
FsServerDefaults currDef = dfsClient.getServerDefaults();
|
||||||
|
return (currDef.getBlockSize() == updatedDefaultBlockSize);
|
||||||
|
} catch (IOException e) {
|
||||||
|
// do nothing;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}, 1, 3000);
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
cluster.shutdown();
|
cluster.shutdown();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user