RussellSpitzer commented on code in PR #4325:
URL: https://github.com/apache/iceberg/pull/4325#discussion_r867347320
##########
spark/v3.2/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestAddFilesProcedure.java:
##########
@@ -759,6 +759,51 @@ public void
testPartitionedImportFromEmptyPartitionDoesNotThrow() {
sql("SELECT * FROM %s ORDER BY id", tableName));
}
+ @Test
+ public void testSkipOnError() throws IOException {
+ createUnpartitionedFileTable("parquet");
+
+ List<Object[]> source = sql("SELECT * FROM %s ORDER BY id",
sourceTableName);
+ Assert.assertEquals(String.format("Rows in source table did not
match\nExpected :%s rows \nFound :%s",
+ 8, source.size()), 8, source.size());
+
+ String createIceberg =
+ "CREATE TABLE %s (id Integer, name String, dept String, subdept
String) USING iceberg";
+
+ sql(createIceberg, tableName);
+
+ File[] expectedFiles = fileTableDir.listFiles((dir, name) ->
!name.endsWith("crc") && !name.contains("_SUCCESS"));
+
+ Assert.assertEquals("Expected number of source files", 2,
expectedFiles.length);
+
+ // Corrupt the second file
+ Assume.assumeTrue("Delete source file!", expectedFiles[1].delete());
Review Comment:
These are not the correct usages of Assume. This will cause the test to be
skipped if the operation returns false rather than fail the test.
In general I think you should only assert on conditions that prove the test
has failed or succeeded, here we have a lot of asserts that check whether test
prep methods work which I think makes the test a bit harder to follow. For
example we make very sure there are 2 source files but this isn't really
relevant except that the test chooses two delete the second file.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]