[HUDI-1989] Fix flakiness in TestHoodieMergeOnReadTable (#3574)
* [HUDI-1989] Refactor clustering tests for MoR table * refactor assertion helper * add CheckedFunction * SparkClientFunctionalTestHarness.java * put back original test case * move testcases out from TestHoodieMergeOnReadTable.java * add TestHoodieSparkMergeOnReadTableRollback.java * use SparkClientFunctionalTestHarness * add tag
This commit is contained in:
@@ -20,10 +20,12 @@
|
||||
package org.apache.hudi.testutils;
|
||||
|
||||
import org.apache.hudi.client.WriteStatus;
|
||||
import org.apache.hudi.common.testutils.CheckedFunction;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertAll;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
|
||||
/**
|
||||
@@ -38,4 +40,15 @@ public class Assertions {
|
||||
assertAll(statuses.stream().map(status -> () ->
|
||||
assertFalse(status.hasErrors(), "Errors found in write of " + status.getFileId())));
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert each file size equal to its source of truth.
|
||||
*
|
||||
* @param fileSizeGetter to retrieve the source of truth of file size.
|
||||
*/
|
||||
public static void assertFileSizesEqual(List<WriteStatus> statuses, CheckedFunction<WriteStatus, Long> fileSizeGetter) {
|
||||
assertAll(statuses.stream().map(status -> () ->
|
||||
assertEquals(fileSizeGetter.apply(status), status.getStat().getFileSizeInBytes())));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user