HDFS-13251. Avoid using hard coded datanode data dirs in unit tests(addendum). Contributed by Ajay Kumar.

This commit is contained in:
Xiaoyu Yao 2018-03-15 09:45:02 -07:00
parent 6de135169e
commit da777a5498
2 changed files with 6 additions and 6 deletions

View File

@ -159,7 +159,7 @@ public class TestDataNodeVolumeFailureToleration {
long dnCapacity = DFSTestUtil.getDatanodeCapacity(dm, 0);
// Fail a volume on the 2nd DN
File dn2Vol1 = cluster.getStorageDir(1, 0);
File dn2Vol1 = cluster.getInstanceStorageDir(1, 0);
DataNodeTestUtils.injectDataDirFailure(dn2Vol1);
// Should only get two replicas (the first DN and the 3rd)

View File

@ -351,11 +351,11 @@ public class TestDFSAdmin {
}
File dnDir0 = cluster.getInstanceStorageDir(0, 0);
File dnDir1 = cluster.getInstanceStorageDir(0, 1);
assertThat(outs.get(offset + 1),
is(allOf(containsString("From:"), containsString(dnDir0.getName()),
assertThat(outs.get(offset + 1), is(allOf(containsString("From:"),
containsString(dnDir0.getName()),
containsString(dnDir1.getName()))));
assertThat(outs.get(offset + 2), is(not(
anyOf(containsString(dnDir0.getName()),
assertThat(outs.get(offset + 2),
is(not(anyOf(containsString(dnDir0.getName()),
containsString(dnDir1.getName())))));
assertThat(outs.get(offset + 2),
is(allOf(containsString("To"), containsString("data_new"))));