Skip to content

Commit 61d08c5

Browse files
author
lgh
committed
test for verify exception msg with empty src file
1 parent acc8139 commit 61d08c5

File tree

1 file changed

+17
-1
lines changed
  • hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router

1 file changed

+17
-1
lines changed

hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterRpc.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1163,6 +1163,21 @@ public void testProxyGetPreferedBlockSize() throws Exception {
11631163
routerProtocol, nnProtocol, m, new Object[] {badPath});
11641164
}
11651165

1166+
private void testConcat(
1167+
String source, String target, boolean failureExpected, boolean verfiyException, String msg) {
1168+
boolean failure = false;
1169+
try {
1170+
// Concat test file with fill block length file via router
1171+
routerProtocol.concat(target, new String[] {source});
1172+
} catch (IOException ex) {
1173+
failure = true;
1174+
if (verfiyException) {
1175+
assertExceptionContains(msg, ex);
1176+
}
1177+
}
1178+
assertEquals(failureExpected, failure);
1179+
}
1180+
11661181
private void testConcat(
11671182
String source, String target, boolean failureExpected) {
11681183
boolean failure = false;
@@ -1242,7 +1257,8 @@ public void testProxyConcatFile() throws Exception {
12421257
String targetFile = cluster.getFederatedTestDirectoryForNS(sameNameservice) + "_targetFile";
12431258
createFile(routerFS, targetFile, existingFileSize);
12441259
// Concat in same namespaces, succeeds
1245-
testConcat(srcEmptyFile, targetFile, true);
1260+
testConcat(srcEmptyFile, targetFile, true, true,
1261+
"concat: source file " + srcEmptyFile + " is invalid or empty or underConstruction");
12461262
}
12471263

12481264
@Test

0 commit comments

Comments
 (0)