-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Flink: Create CatalogTestBase for migration to JUnit5 #9364
Conversation
import org.junit.jupiter.api.io.TempDir; | ||
|
||
@ExtendWith(ParameterizedTestExtension.class) | ||
public abstract class FlinkCatalogTestBaseJU5 extends TestBase { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can just call this CatalogTestBase
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ack
can you also please convert |
I tested this implementation with couple of subclasses and it seems to be working fine. The difference that I observed here as compared to junit4 in terms of test execution. First test is triggered with all the supplied parameters in serial order then only it proceeds to next test in the sequence. |
ack |
Can you include the subclasses you tested in this PR and convert them to JUnit5 in a separate commit? |
…atalogTestBaseJU5 to CatalogTestBase
Thanks for the review, @nastra I have added following changes
|
flink/v1.18/flink/src/test/java/org/apache/iceberg/flink/TestFlinkCatalogDatabase.java
Outdated
Show resolved
Hide resolved
flink/v1.18/flink/src/test/java/org/apache/iceberg/flink/TestFlinkCatalogDatabase.java
Outdated
Show resolved
Hide resolved
flink/v1.18/flink/src/test/java/org/apache/iceberg/flink/TestFlinkCatalogDatabase.java
Outdated
Show resolved
Hide resolved
flink/v1.18/flink/src/test/java/org/apache/iceberg/flink/TestFlinkCatalogDatabase.java
Outdated
Show resolved
Hide resolved
flink/v1.18/flink/src/test/java/org/apache/iceberg/flink/TestFlinkCatalogDatabase.java
Outdated
Show resolved
Hide resolved
Addressed Following review comments
|
flink/v1.18/flink/src/test/java/org/apache/iceberg/flink/TestFlinkCatalogDatabase.java
Outdated
Show resolved
Hide resolved
flink/v1.18/flink/src/test/java/org/apache/iceberg/flink/TestFlinkCatalogDatabase.java
Outdated
Show resolved
Hide resolved
flink/v1.18/flink/src/test/java/org/apache/iceberg/flink/TestFlinkCatalogDatabase.java
Outdated
Show resolved
Hide resolved
flink/v1.18/flink/src/test/java/org/apache/iceberg/flink/TestFlinkCatalogDatabase.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've left a few minor comments, can you also please convert TestMetadataTableReadableMetrics
and include it in this PR? In a follow-up PR we should then include all the other tests that currently extent FlinkCatalogTestBase
and convert them to use CatalogTestBase
.
protected boolean isHadoopCatalog; | ||
|
||
@Parameters(name = "catalogName={0} baseNamespace={1}") | ||
static List<Object[]> parametrs() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static List<Object[]> parametrs() { | |
protected static List<Object[]> parameters() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ack
flink/v1.18/flink/src/test/java/org/apache/iceberg/flink/CatalogTestBase.java
Outdated
Show resolved
Hide resolved
…dataTableReadableMetrics and TestFlinkCatalogTablePartitions
|
flink/v1.18/flink/src/test/java/org/apache/iceberg/flink/TestFlinkCatalogDatabase.java
Outdated
Show resolved
Hide resolved
|
assertThat(validationNamespaceCatalog.namespaceExists(icebergNamespace)) | ||
.as("Namespace should exist") | ||
.isTrue(); | ||
assertThat(sql("SHOW TABLES").size()).as("Should not list any tables").isEqualTo(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assertThat(sql("SHOW TABLES").size()).as("Should not list any tables").isEqualTo(0); | |
assertThat(sql("SHOW TABLES")).isEmpty(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ack
flink/v1.18/flink/src/test/java/org/apache/iceberg/flink/TestFlinkCatalogDatabase.java
Outdated
Show resolved
Hide resolved
@@ -76,7 +72,7 @@ protected TableEnvironment getTableEnv() { | |||
return super.getTableEnv(); | |||
} | |||
|
|||
@Rule public TemporaryFolder temp = new TemporaryFolder(); | |||
@TempDir Path temp; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can be private (unless there's a subclass that might use this)
@@ -134,8 +130,7 @@ private Table createPrimitiveTable() throws IOException { | |||
createPrimitiveRecord( | |||
false, 2, 2L, Float.NaN, 2.0D, new BigDecimal("2.00"), "2", null, null)); | |||
|
|||
DataFile dataFile = | |||
FileHelpers.writeDataFile(table, Files.localOutput(temp.newFile()), records); | |||
DataFile dataFile = FileHelpers.writeDataFile(table, Files.localOutput(temp.toFile()), records); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be doing File.createTempFile("junit", null, temp.toFile())
instead of temp.toFile()
, similar to how it was done in #9341. The same needs to be done in L151
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ack
@vinitpatni just a few minor things, but should be ready to go once those are addressed |
|
@nastra Thanks for merging my changes. I have also completed Junit 5 conversion and AssertJ style for TestFlinkCatalogTable and TestFlinkMetadataTable. Should I created Separate PR or follow up on this one ? |
Just create a new PR |
…se for migration to JUnit5
…se for migration to JUnit5
…se for migration to JUnit5
…se for migration to JUnit5 (apache#9601)
…se for migration to JUnit5 (apache#9601)
Base class creation of FlinkCatalogTestBase for the migration to JUnit5 in regards to #9079