You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2022/05/24 09:24:22 UTC

[GitHub] [flink] RyanSkraba commented on a diff in pull request #19780: [FLINK-27727][tests] Migrate TypeSerializerUpgradeTestBase to JUnit5

RyanSkraba commented on code in PR #19780:
URL: https://github.com/apache/flink/pull/19780#discussion_r880270826


##########
flink-core/src/test/java/org/apache/flink/api/common/typeutils/TypeSerializerUpgradeTestBase.java:
##########
@@ -46,28 +50,25 @@
 /**
  * A test base for testing {@link TypeSerializer} upgrades.
  *
- * <p>You can run {@link #generateTestSetupFiles()} on a Flink branch to (re-)generate the test data
- * files.
+ * <p>You can run {@link
+ * #generateTestSetupFiles(org.apache.flink.api.common.typeutils.TypeSerializerUpgradeTestBase.TestSpecification)}
+ * on a Flink branch to (re-)generate the test data files.
  */
-public abstract class TypeSerializerUpgradeTestBase<PreviousElementT, UpgradedElementT>
-        extends TestLogger {
+@ExtendWith(TestLoggerExtension.class)
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
+public abstract class TypeSerializerUpgradeTestBase<PreviousElementT, UpgradedElementT> {
 
     public static final FlinkVersion CURRENT_VERSION = FlinkVersion.v1_15;
 
     public static final Set<FlinkVersion> MIGRATION_VERSIONS =
             FlinkVersion.rangeOf(FlinkVersion.v1_11, CURRENT_VERSION);
 
-    private final TestSpecification<PreviousElementT, UpgradedElementT> testSpecification;
-
-    protected TypeSerializerUpgradeTestBase(
-            TestSpecification<PreviousElementT, UpgradedElementT> testSpecification) {
-        this.testSpecification = checkNotNull(testSpecification);
-    }
-
     // ------------------------------------------------------------------------------
     //  APIs
     // ------------------------------------------------------------------------------
 
+    public abstract Stream<TestSpecification<?, ?>> testData() throws Exception;

Review Comment:
   This could return `Collection<...>` instead of `Stream<...>`, and almost every single implementation works with `ArrayList` (LinkedListSerializerUpgradeTest is the only one that uses Stream directly).
   
   This isn't even a nit-pick, I have no strong opinion whether or not we align to Stream or Collection!  Just pointing it out in case you thought `Stream<...>` was mandatory for `@MethodSource`



##########
flink-core/src/test/java/org/apache/flink/api/common/typeutils/TypeSerializerUpgradeTestBase.java:
##########
@@ -46,28 +50,25 @@
 /**
  * A test base for testing {@link TypeSerializer} upgrades.
  *
- * <p>You can run {@link #generateTestSetupFiles()} on a Flink branch to (re-)generate the test data
- * files.
+ * <p>You can run {@link
+ * #generateTestSetupFiles(org.apache.flink.api.common.typeutils.TypeSerializerUpgradeTestBase.TestSpecification)}
+ * on a Flink branch to (re-)generate the test data files.
  */
-public abstract class TypeSerializerUpgradeTestBase<PreviousElementT, UpgradedElementT>
-        extends TestLogger {
+@ExtendWith(TestLoggerExtension.class)
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)

Review Comment:
   Interesting: I didn't realize this lets you use abstract `testData()` as a `MethodSource`, which is perfect!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org