Skip to content

Conversation

@tomtongue
Copy link
Contributor

@tomtongue tomtongue commented Mar 22, 2024

Migrate the following test classes in iceberg-core to JUnit 5 and AssertJ style for #9085.

Current Progress

  • TestMetricsModes.java
  • TestMicroBatchBuilder.java
  • TestRemoveSnapshots.java
  • TestRewriteManifests.java
  • TestRowDelta.java
  • TestSequenceNumberForV2Table.java
  • TestSingleValueParser.java
  • TestSortOrder.java
  • TestSortOrderParser.java
  • TestSplitPlanning.java
  • TestV1ToV2RowDeltaDelete.java
  • V2TableTestBase.java

Refactoring (related to #10014 (comment)):

  • TestSchemaAndMappingUpdate.java
  • TestSchemaUpdate

@github-actions github-actions bot added the core label Mar 22, 2024
@tomtongue tomtongue changed the title [WIP] Migrate other files in Core to JUnit5 Migrate other files in Core to JUnit5 Mar 24, 2024
@tomtongue
Copy link
Contributor Author

tomtongue commented Mar 25, 2024

@nastra Could you review this PR?

Just let you know, the following two classes in org/apache/iceberg will be migrated:

  • TestWapWorkflow
  • TestMetrics (this class is related files in iceberg-data)


@Rule public TemporaryFolder temp = new TemporaryFolder();
private Table table = null;
// @Rule public TemporaryFolder temp = new TemporaryFolder();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be removed

Copy link
Contributor Author

@tomtongue tomtongue Mar 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Remove this comment.

.allManifests(table.io())
.get(0)
.path(), // manifest contained only deletes, was dropped
FILE_A.path().toString() // deleted
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is toString() needed here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not needed. Remove toString() here.

.get(0)
.path(), // manifest was rewritten for delete
secondSnapshot.manifestListLocation(), // snapshot expired
FILE_A.path()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

original comment is missing here: // deleted

.isEqualTo(
Sets.newHashSet(
secondSnapshot.manifestListLocation(), // snapshot expired
Iterables.getOnlyElement(secondSnapshotManifests)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we avoid using Iterables here?

assertThat(table.currentSnapshot()).isEqualTo(thirdSnapshot);
assertThat(table.snapshots()).hasSize(1);
assertThat(deletedFiles)
.isEqualTo(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.containsExactly()

Copy link
Contributor Author

@tomtongue tomtongue Mar 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The order of firstSnapshot.manifestLocation and secondSnapshot.manifestLocation depends on the hashset values, so the order is not always the same. So, I believe this part needs to use isEqualTo, or containsExactlyInAnyOrder.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's use containsExactlyInAnyOrder then

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, thank you!

@nastra
Copy link
Contributor

nastra commented Mar 25, 2024

@nastra Could you review this PR?

Just let you know, the following two classes in org/apache/iceberg will be migrated:

  • TestWapWorkflow
  • TestMetrics (this class is related files in iceberg-data)

You mean migrated in a separate PR? Also I see a few more files in core that need to be migrated:

junit4tests

@tomtongue
Copy link
Contributor Author

@nastra Could you review this PR?
Just let you know, the following two classes in org/apache/iceberg will be migrated:

  • TestWapWorkflow
  • TestMetrics (this class is related files in iceberg-data)

You mean migrated in a separate PR? Also I see a few more files in core that need to be migrated:

I will submit a PR for the two classes TestWapWorkflow and TestMetrics. These two classes are remaining classes in org/apache/iceberg.

There are also some files to be migrated in some sub-packages (like actions, avro etc.) in org/apache/iceberg. I will check which file in the sub-packages should be migrated to JUnit5.

@tomtongue tomtongue force-pushed the mig-junit5-core-others branch from 0cdeef9 to 2543b29 Compare March 25, 2024 14:16
@nastra nastra merged commit 49a6634 into apache:main Mar 25, 2024
@tomtongue tomtongue deleted the mig-junit5-core-others branch March 26, 2024 00:50
zachdisc pushed a commit to zachdisc/iceberg that referenced this pull request Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants