HDFS-16345. Fix test case fail in TestBlockStoragePolicy (#3696). Contributed by guophilipse.
Reviewed-by: Akira Ajisaka <aajisaka@apache.org>
Signed-off-by: Ayush Saxena <ayushsaxena@apache.org>
(cherry picked from commit 25849ff7b7
)
This commit is contained in:
parent
9a1c8d2f41
commit
2720479988
@ -1237,6 +1237,7 @@ public void testChooseTargetWithTopology() throws Exception {
|
||||
DFSTestUtil.formatNameNode(conf);
|
||||
NameNode namenode = new NameNode(conf);
|
||||
|
||||
try {
|
||||
final BlockManager bm = namenode.getNamesystem().getBlockManager();
|
||||
BlockPlacementPolicy replicator = bm.getBlockPlacementPolicy();
|
||||
NetworkTopology cluster = bm.getDatanodeManager().getNetworkTopology();
|
||||
@ -1254,6 +1255,11 @@ public void testChooseTargetWithTopology() throws Exception {
|
||||
new HashSet<Node>(), 0, policy2, null);
|
||||
System.out.println(Arrays.asList(targets));
|
||||
Assert.assertEquals(3, targets.length);
|
||||
} finally {
|
||||
if (namenode != null) {
|
||||
namenode.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -1284,6 +1290,7 @@ public void testChooseSsdOverDisk() throws Exception {
|
||||
DFSTestUtil.formatNameNode(conf);
|
||||
NameNode namenode = new NameNode(conf);
|
||||
|
||||
try {
|
||||
final BlockManager bm = namenode.getNamesystem().getBlockManager();
|
||||
BlockPlacementPolicy replicator = bm.getBlockPlacementPolicy();
|
||||
NetworkTopology cluster = bm.getDatanodeManager().getNetworkTopology();
|
||||
@ -1298,6 +1305,11 @@ public void testChooseSsdOverDisk() throws Exception {
|
||||
Assert.assertEquals(2, targets.length);
|
||||
Assert.assertEquals(StorageType.SSD, targets[0].getStorageType());
|
||||
Assert.assertEquals(StorageType.DISK, targets[1].getStorageType());
|
||||
} finally {
|
||||
if (namenode != null) {
|
||||
namenode.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1337,6 +1349,7 @@ public void testAddDatanode2ExistingPipelineInSsd() throws Exception {
|
||||
DFSTestUtil.formatNameNode(conf);
|
||||
NameNode namenode = new NameNode(conf);
|
||||
|
||||
try {
|
||||
final BlockManager bm = namenode.getNamesystem().getBlockManager();
|
||||
BlockPlacementPolicy replicator = bm.getBlockPlacementPolicy();
|
||||
NetworkTopology cluster = bm.getDatanodeManager().getNetworkTopology();
|
||||
@ -1351,6 +1364,11 @@ public void testAddDatanode2ExistingPipelineInSsd() throws Exception {
|
||||
null, chsenDs, true,
|
||||
new HashSet<Node>(), 0, policy, null);
|
||||
Assert.assertEquals(3, targets.length);
|
||||
} finally {
|
||||
if (namenode != null) {
|
||||
namenode.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
Reference in New Issue
Block a user