Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove number from assert description #11827

Merged
merged 4 commits into from
Dec 20, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ public void testUnpartitioned() throws Exception {
.option(SizeBasedFileRewriter.REWRITE_ALL, "true")
.execute();
List<DeleteFile> newDeleteFiles = deleteFiles(table);
assertThat(newDeleteFiles).as("Expected 1 new delete file").hasSize(1);
assertThat(newDeleteFiles).as("New delete files").hasSize(1);
assertLocallySorted(newDeleteFiles);
assertNotContains(deleteFiles, newDeleteFiles);
checkResult(result, deleteFiles, newDeleteFiles, 1);
Expand Down Expand Up @@ -326,7 +326,7 @@ public void testRewriteToSmallerTarget() throws Exception {
.option(SizeBasedFileRewriter.TARGET_FILE_SIZE_BYTES, String.valueOf(avgSize / 2))
.execute();
List<DeleteFile> newDeleteFiles = deleteFiles(table);
assertThat(newDeleteFiles).as("Should have 8 new delete files").hasSize(8);
assertThat(newDeleteFiles).as("New delete files").hasSize(8);
assertNotContains(deleteFiles, newDeleteFiles);
assertLocallySorted(newDeleteFiles);
checkResult(result, deleteFiles, newDeleteFiles, 4);
Expand Down Expand Up @@ -371,7 +371,7 @@ public void testRemoveDanglingDeletes() throws Exception {
.option(SizeBasedFileRewriter.REWRITE_ALL, "true")
.execute();
List<DeleteFile> newDeleteFiles = deleteFiles(table);
assertThat(newDeleteFiles).as("Should have 0 new delete files").hasSize(0);
assertThat(newDeleteFiles).as("New delete files").isEmpty();
assertNotContains(deleteFiles, newDeleteFiles);
assertLocallySorted(newDeleteFiles);
checkResult(result, deleteFiles, newDeleteFiles, 4);
Expand All @@ -380,7 +380,7 @@ public void testRemoveDanglingDeletes() throws Exception {
List<Object[]> actualRecords = records(table);
List<Object[]> actualDeletes = deleteRecords(table);
assertEquals("Rows must match", expectedRecords, actualRecords);
assertThat(actualDeletes).as("Should be no new position deletes").hasSize(0);
assertThat(actualDeletes).as("No new position deletes").isEmpty();
Fokko marked this conversation as resolved.
Show resolved Hide resolved
}

@TestTemplate
Expand Down Expand Up @@ -413,7 +413,7 @@ public void testSomePartitionsDanglingDeletes() throws Exception {
.option(SizeBasedFileRewriter.REWRITE_ALL, "true")
.execute();
List<DeleteFile> newDeleteFiles = deleteFiles(table);
assertThat(newDeleteFiles).as("Should have 2 new delete files").hasSize(2);
assertThat(newDeleteFiles).as("New delete files").hasSize(2);
assertNotContains(deleteFiles, newDeleteFiles);
assertLocallySorted(newDeleteFiles);
checkResult(result, deleteFiles, newDeleteFiles, 4);
Expand Down Expand Up @@ -469,7 +469,7 @@ public void testRewriteFilterRemoveDangling() throws Exception {
.execute();

List<DeleteFile> newDeleteFiles = except(deleteFiles(table), deleteFiles);
assertThat(newDeleteFiles).as("New delete files").hasSize(0);
assertThat(newDeleteFiles).as("New delete files").isEmpty();

List<DeleteFile> expectedRewrittenFiles =
filterFiles(table, deleteFiles, ImmutableList.of(0), ImmutableList.of(1));
Expand Down Expand Up @@ -524,7 +524,7 @@ public void testPartitionEvolutionAdd() throws Exception {
Stream.concat(unpartitionedDeleteFiles.stream(), partitionedDeleteFiles.stream())
.collect(Collectors.toList());
List<DeleteFile> newDeleteFiles = deleteFiles(table);
assertThat(newDeleteFiles).as("Should have 3 new delete files").hasSize(3);
assertThat(newDeleteFiles).as("New delete files").hasSize(3);
assertNotContains(rewrittenDeleteFiles, newDeleteFiles);
assertLocallySorted(newDeleteFiles);
checkResult(result, rewrittenDeleteFiles, newDeleteFiles, 3);
Expand Down Expand Up @@ -571,7 +571,7 @@ public void testPartitionEvolutionRemove() throws Exception {
.option(SizeBasedFileRewriter.REWRITE_ALL, "true")
.execute();
List<DeleteFile> newDeleteFiles = deleteFiles(table);
assertThat(newDeleteFiles).as("Should have 3 new delete files").hasSize(3);
assertThat(newDeleteFiles).as("New delete files").hasSize(3);
assertNotContains(expectedRewritten, newDeleteFiles);
assertLocallySorted(newDeleteFiles);
checkResult(result, expectedRewritten, newDeleteFiles, 3);
Expand Down Expand Up @@ -622,7 +622,7 @@ public void testSchemaEvolution() throws Exception {
Stream.concat(deleteFiles.stream(), newSchemaDeleteFiles.stream())
.collect(Collectors.toList());
List<DeleteFile> newDeleteFiles = deleteFiles(table);
assertThat(newDeleteFiles).as("Should have 2 new delete files").hasSize(4);
assertThat(newDeleteFiles).as("New delete files").hasSize(4);
assertNotContains(rewrittenDeleteFiles, newDeleteFiles);
assertLocallySorted(newDeleteFiles);
checkResult(result, rewrittenDeleteFiles, newDeleteFiles, 4);
Expand Down Expand Up @@ -948,7 +948,7 @@ private void assertNotContains(List<DeleteFile> original, List<DeleteFile> rewri
Set<String> rewrittenPaths =
rewritten.stream().map(ContentFile::location).collect(Collectors.toSet());
rewrittenPaths.retainAll(originalPaths);
assertThat(rewrittenPaths).hasSize(0);
assertThat(rewrittenPaths).isEmpty();
}

private void assertLocallySorted(List<DeleteFile> deleteFiles) {
Expand Down Expand Up @@ -1054,48 +1054,48 @@ private void checkResult(
List<DeleteFile> newDeletes,
int expectedGroups) {
assertThat(rewrittenDeletes.size())
.as("Expected rewritten delete file count does not match")
.as("Rewritten delete file count does not match")
Fokko marked this conversation as resolved.
Show resolved Hide resolved
.isEqualTo(result.rewrittenDeleteFilesCount());

assertThat(newDeletes.size())
.as("Expected new delete file count does not match")
.as("New delete file count does not match")
.isEqualTo(result.addedDeleteFilesCount());

assertThat(size(rewrittenDeletes))
.as("Expected rewritten delete byte count does not match")
.as("Rewritten delete byte count does not match")
.isEqualTo(result.rewrittenBytesCount());

assertThat(size(newDeletes))
.as("Expected new delete byte count does not match")
.as("New delete byte count does not match")
.isEqualTo(result.addedBytesCount());

assertThat(expectedGroups)
.as("Expected rewrite group count does not match")
.as("Rewrite group count does not match")
.isEqualTo(result.rewriteResults().size());

assertThat(rewrittenDeletes.size())
.as("Expected rewritten delete file count in all groups to match")
.as("Rewritten delete file count in all groups to match")
.isEqualTo(
result.rewriteResults().stream()
.mapToInt(FileGroupRewriteResult::rewrittenDeleteFilesCount)
.sum());

assertThat(newDeletes.size())
.as("Expected added delete file count in all groups to match")
.as("Added delete file count in all groups to match")
.isEqualTo(
result.rewriteResults().stream()
.mapToInt(FileGroupRewriteResult::addedDeleteFilesCount)
.sum());

assertThat(size(rewrittenDeletes))
.as("Expected rewritten delete bytes in all groups to match")
.as("Rewritten delete bytes in all groups to match")
.isEqualTo(
result.rewriteResults().stream()
.mapToLong(FileGroupRewriteResult::rewrittenBytesCount)
.sum());

assertThat(size(newDeletes))
.as("Expected added delete bytes in all groups to match")
.as("Added delete bytes in all groups to match")
.isEqualTo(
result.rewriteResults().stream()
.mapToLong(FileGroupRewriteResult::addedBytesCount)
Expand Down