steveloughran commented on a change in pull request #1003: HADOOP-16384: Avoid
inconsistencies between DDB and S3
URL: https://github.com/apache/hadoop/pull/1003#discussion_r302148149
##########
File path:
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/contract/AbstractContractRootDirectoryTest.java
##########
@@ -185,28 +191,57 @@ public void testListEmptyRootDirectory() throws
IOException {
for (FileStatus status : statuses) {
ContractTestUtils.assertDeleted(fs, status.getPath(), true);
}
- assertEquals("listStatus on empty root-directory returned a non-empty
list",
- 0, fs.listStatus(root).length);
- assertFalse("listFiles(/, false).hasNext",
- fs.listFiles(root, false).hasNext());
- assertFalse("listFiles(/, true).hasNext",
- fs.listFiles(root, true).hasNext());
- assertFalse("listLocatedStatus(/).hasNext",
- fs.listLocatedStatus(root).hasNext());
+ FileStatus[] list1 = fs.listStatus(root);
+ assertEquals("listStatus on empty root-directory returned found: "
+ + join("\n", list1),
+ 0, list1.length);
+ assertNoElements("listFiles(/, false)",
+ fs.listFiles(root, false));
+ assertNoElements("listFiles(/, true)",
+ fs.listFiles(root, true));
+ assertNoElements("listLocatedStatus(/)",
+ fs.listLocatedStatus(root));
assertIsDirectory(root);
}
+ /**
+ * Assert that an iterator has no elements; the raised exception
+ * will include the element list.
+ * @param operation operation for assertion text.
+ * @param iter iterator
+ * @throws IOException failure retrieving the values.
+ */
+ protected void assertNoElements(String operation,
+ RemoteIterator<LocatedFileStatus> iter) throws IOException {
+ List<LocatedFileStatus> resultList = toList(iter);
+ if (!resultList.isEmpty()) {
+ fail("Expected no results from " + operation + ", but got "
Review comment:
thx. I'm picking up assertJ assertions in hadoop-aws code but not yet
adopted any in hadoop-common
----------------------------------------------------------------
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]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]