[HUDI-810] Migrate ClientTestHarness to JUnit 5 (#1553)
This commit is contained in:
@@ -50,9 +50,11 @@ public class TestHoodieTableMetaClient extends HoodieCommonTestHarnessJunit5 {
|
||||
|
||||
@Test
|
||||
public void checkMetadata() {
|
||||
assertEquals(HoodieTestUtils.RAW_TRIPS_TEST_NAME, metaClient.getTableConfig().getTableName(), "Table name should be raw_trips");
|
||||
assertEquals(HoodieTestUtils.RAW_TRIPS_TEST_NAME, metaClient.getTableConfig().getTableName(),
|
||||
"Table name should be raw_trips");
|
||||
assertEquals(basePath, metaClient.getBasePath(), "Basepath should be the one assigned");
|
||||
assertEquals(basePath + "/.hoodie", metaClient.getMetaPath(), "Metapath should be ${basepath}/.hoodie");
|
||||
assertEquals(basePath + "/.hoodie", metaClient.getMetaPath(),
|
||||
"Metapath should be ${basepath}/.hoodie");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -67,8 +69,10 @@ public class TestHoodieTableMetaClient extends HoodieCommonTestHarnessJunit5 {
|
||||
commitTimeline.saveAsComplete(instant, Option.of("test-detail".getBytes()));
|
||||
commitTimeline = commitTimeline.reload();
|
||||
HoodieInstant completedInstant = HoodieTimeline.getCompletedInstant(instant);
|
||||
assertEquals(completedInstant, commitTimeline.getInstants().findFirst().get(), "Commit should be 1 and completed");
|
||||
assertArrayEquals("test-detail".getBytes(), commitTimeline.getInstantDetails(completedInstant).get(), "Commit value should be \"test-detail\"");
|
||||
assertEquals(completedInstant, commitTimeline.getInstants().findFirst().get(),
|
||||
"Commit should be 1 and completed");
|
||||
assertArrayEquals("test-detail".getBytes(), commitTimeline.getInstantDetails(completedInstant).get(),
|
||||
"Commit value should be \"test-detail\"");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -90,8 +94,10 @@ public class TestHoodieTableMetaClient extends HoodieCommonTestHarnessJunit5 {
|
||||
activeTimeline = activeTimeline.reload();
|
||||
activeCommitTimeline = activeTimeline.getCommitTimeline();
|
||||
assertFalse(activeCommitTimeline.empty(), "Should be the 1 commit we made");
|
||||
assertEquals(completedInstant, activeCommitTimeline.getInstants().findFirst().get(), "Commit should be 1");
|
||||
assertArrayEquals("test-detail".getBytes(), activeCommitTimeline.getInstantDetails(completedInstant).get(), "Commit value should be \"test-detail\"");
|
||||
assertEquals(completedInstant, activeCommitTimeline.getInstants().findFirst().get(),
|
||||
"Commit should be 1");
|
||||
assertArrayEquals("test-detail".getBytes(), activeCommitTimeline.getInstantDetails(completedInstant).get(),
|
||||
"Commit value should be \"test-detail\"");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -288,7 +288,8 @@ public class TestHoodieTableFileSystemView extends HoodieCommonTestHarnessJunit5
|
||||
refreshFsView();
|
||||
List<FileSlice> slices = rtView.getLatestFileSlices(partitionPath).collect(Collectors.toList());
|
||||
assertEquals(1, slices.size(), "Expected latest file-slices");
|
||||
assertEquals(compactionRequestedTime, slices.get(0).getBaseInstantTime(), "Base-Instant must be compaction Instant");
|
||||
assertEquals(compactionRequestedTime, slices.get(0).getBaseInstantTime(),
|
||||
"Base-Instant must be compaction Instant");
|
||||
assertFalse(slices.get(0).getBaseFile().isPresent(), "Latest File Slice must not have data-file");
|
||||
assertEquals(0, slices.get(0).getLogFiles().count(), "Latest File Slice must not have any log-files");
|
||||
|
||||
@@ -328,7 +329,8 @@ public class TestHoodieTableFileSystemView extends HoodieCommonTestHarnessJunit5
|
||||
} else {
|
||||
assertFalse(fileSlice.getBaseFile().isPresent(), "No data-file expected as it was not created");
|
||||
}
|
||||
assertEquals(instantTime1, fileSlice.getBaseInstantTime(), "Base Instant of penultimate file-slice must be base instant");
|
||||
assertEquals(instantTime1, fileSlice.getBaseInstantTime(),
|
||||
"Base Instant of penultimate file-slice must be base instant");
|
||||
List<HoodieLogFile> logFiles = fileSlice.getLogFiles().collect(Collectors.toList());
|
||||
assertEquals(4, logFiles.size(), "Log files must include those after compaction request");
|
||||
assertEquals(fileName4, logFiles.get(0).getFileName(), "Log File Order check");
|
||||
@@ -342,7 +344,8 @@ public class TestHoodieTableFileSystemView extends HoodieCommonTestHarnessJunit5
|
||||
fileSlice = fileSliceList.get(0);
|
||||
assertEquals(fileId, fileSlice.getFileId());
|
||||
assertFalse(fileSlice.getBaseFile().isPresent(), "No data-file expected in latest file-slice");
|
||||
assertEquals(compactionRequestedTime, fileSlice.getBaseInstantTime(), "Compaction requested instant must be base instant");
|
||||
assertEquals(compactionRequestedTime, fileSlice.getBaseInstantTime(),
|
||||
"Compaction requested instant must be base instant");
|
||||
logFiles = fileSlice.getLogFiles().collect(Collectors.toList());
|
||||
assertEquals(2, logFiles.size(), "Log files must include only those after compaction request");
|
||||
assertEquals(fileName4, logFiles.get(0).getFileName(), "Log File Order check");
|
||||
@@ -457,7 +460,8 @@ public class TestHoodieTableFileSystemView extends HoodieCommonTestHarnessJunit5
|
||||
"Orphan File Slice with log-file check data-file");
|
||||
logFiles = orphanFileSliceWithLogFile.getLogFiles().collect(Collectors.toList());
|
||||
assertEquals(1, logFiles.size(), "Orphan File Slice with log-file check data-file");
|
||||
assertEquals(orphanLogFileName, logFiles.get(0).getFileName(), "Orphan File Slice with log-file check data-file");
|
||||
assertEquals(orphanLogFileName, logFiles.get(0).getFileName(),
|
||||
"Orphan File Slice with log-file check data-file");
|
||||
assertEquals(inflightDeltaInstantTime, inflightFileSliceWithLogFile.getBaseInstantTime(),
|
||||
"Inflight File Slice with log-file check base-commit");
|
||||
assertFalse(inflightFileSliceWithLogFile.getBaseFile().isPresent(),
|
||||
@@ -1115,7 +1119,8 @@ public class TestHoodieTableFileSystemView extends HoodieCommonTestHarnessJunit5
|
||||
fileSlice = fileSliceList.get(0);
|
||||
assertEquals(fileId, fileSlice.getFileId());
|
||||
assertFalse(fileSlice.getBaseFile().isPresent(), "No data-file expected in latest file-slice");
|
||||
assertEquals(compactionRequestedTime, fileSlice.getBaseInstantTime(), "Compaction requested instant must be base instant");
|
||||
assertEquals(compactionRequestedTime, fileSlice.getBaseInstantTime(),
|
||||
"Compaction requested instant must be base instant");
|
||||
logFiles = fileSlice.getLogFiles().collect(Collectors.toList());
|
||||
assertEquals(2, logFiles.size(), "Log files must include only those after compaction request");
|
||||
assertEquals(fileName4, logFiles.get(0).getFileName(), "Log File Order check");
|
||||
|
||||
Reference in New Issue
Block a user