MartijnVisser commented on code in PR #30047:
URL: https://github.com/apache/flink/pull/30047#discussion_r4667804530


##########
flink-filesystems/flink-s3-fs-native/src/test/java/org/apache/flink/fs/s3native/HAJobRunOnNativeS3FileSystemITCase.java:
##########
@@ -18,22 +18,80 @@
 
 package org.apache.flink.fs.s3native;
 
-import org.junit.jupiter.api.Order;
+import org.apache.flink.core.testutils.AllCallbackWrapper;
+import org.apache.flink.core.testutils.TestContainerExtension;
+import org.apache.flink.runtime.minicluster.MiniCluster;
+import org.apache.flink.runtime.testutils.MiniClusterResource;
+import org.apache.flink.runtime.testutils.MiniClusterResourceConfiguration;
+import org.apache.flink.testutils.junit.extensions.parameterized.Parameter;
+import 
org.apache.flink.testutils.junit.extensions.parameterized.ParameterizedTestExtension;
+import org.apache.flink.testutils.junit.extensions.parameterized.Parameters;
+
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.TestTemplate;
+import org.junit.jupiter.api.extension.ExtendWith;
 import org.junit.jupiter.api.extension.RegisterExtension;
 
-/** HA Job Test Implementation. * */
+import java.util.Arrays;
+import java.util.Collection;
+
+/** Runs the HA job test with the default HTTP client and with the CRT client. 
*/
+@ExtendWith(ParameterizedTestExtension.class)
 class HAJobRunOnNativeS3FileSystemITCase extends 
AbstractNativeS3HAJobRunITCase {
 
-    // AbstractHAJobRunITCase already registers its own extension at 
@Order(1), so this one must
-    // run after it.
     @RegisterExtension
-    @Order(2)
-    private static final SeaweedFsNativeS3HAClusterExtension CLUSTER_EXTENSION 
=
-            new SeaweedFsNativeS3HAClusterExtension(
-                    AbstractNativeS3HAJobRunITCase::createConfiguration);
+    private static final 
AllCallbackWrapper<TestContainerExtension<SeaweedFsNativeS3TestContainer>>
+            SEAWEEDFS_EXTENSION =
+                    new AllCallbackWrapper<>(
+                            new 
TestContainerExtension<>(SeaweedFsNativeS3TestContainer::new));
+
+    @Parameter private boolean crtEnabled;
+
+    private MiniClusterResource cluster;
+
+    @Parameters(name = "crt={0}")
+    private static Collection<Boolean> parameters() {
+        return Arrays.asList(false, true);
+    }
+
+    @BeforeEach
+    void startCluster() throws Exception {
+        cluster =
+                new MiniClusterResource(
+                        new MiniClusterResourceConfiguration.Builder()
+                                .setConfiguration(
+                                        createConfiguration(
+                                                getSeaweedFsContainer(),
+                                                getClusterId(),
+                                                crtEnabled))
+                                .build());
+        cluster.before();
+    }
+
+    @AfterEach
+    void stopCluster() {
+        if (cluster != null) {
+            cluster.after();
+        }
+    }
+
+    // Overridden without @Test so JUnit skips it; startCluster() starts a 
cluster per parameter.
+    @Override
+    public void testJobExecutionInHaMode(MiniCluster flinkCluster) {}
+
+    @TestTemplate
+    void testJobExecutionInHaModePerHttpClient() throws Exception {
+        runJobInHaMode(cluster.getMiniCluster());
+    }
 
     @Override
     SeaweedFsNativeS3TestContainer getSeaweedFsContainer() {
-        return CLUSTER_EXTENSION.getContainer();
+        return SEAWEEDFS_EXTENSION.getCustomExtension().getTestContainer();
+    }
+
+    @Override
+    String getClusterId() {
+        return crtEnabled ? "test-cluster-crt" : "test-cluster";

Review Comment:
   Both runs shared one bucket, so without the tag the CRT run passed on the 
`JobResultStore` entry the default run had written. Each class now gets its own 
container, so the tag is gone.



##########
flink-filesystems/flink-s3-fs-native/src/test/java/org/apache/flink/fs/s3native/HAJobRunOnNativeS3FileSystemITCase.java:
##########
@@ -18,22 +18,80 @@
 
 package org.apache.flink.fs.s3native;
 
-import org.junit.jupiter.api.Order;
+import org.apache.flink.core.testutils.AllCallbackWrapper;
+import org.apache.flink.core.testutils.TestContainerExtension;
+import org.apache.flink.runtime.minicluster.MiniCluster;
+import org.apache.flink.runtime.testutils.MiniClusterResource;
+import org.apache.flink.runtime.testutils.MiniClusterResourceConfiguration;
+import org.apache.flink.testutils.junit.extensions.parameterized.Parameter;
+import 
org.apache.flink.testutils.junit.extensions.parameterized.ParameterizedTestExtension;
+import org.apache.flink.testutils.junit.extensions.parameterized.Parameters;
+
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.TestTemplate;
+import org.junit.jupiter.api.extension.ExtendWith;
 import org.junit.jupiter.api.extension.RegisterExtension;
 
-/** HA Job Test Implementation. * */
+import java.util.Arrays;
+import java.util.Collection;
+
+/** Runs the HA job test with the default HTTP client and with the CRT client. 
*/
+@ExtendWith(ParameterizedTestExtension.class)
 class HAJobRunOnNativeS3FileSystemITCase extends 
AbstractNativeS3HAJobRunITCase {
 
-    // AbstractHAJobRunITCase already registers its own extension at 
@Order(1), so this one must
-    // run after it.
     @RegisterExtension
-    @Order(2)
-    private static final SeaweedFsNativeS3HAClusterExtension CLUSTER_EXTENSION 
=
-            new SeaweedFsNativeS3HAClusterExtension(
-                    AbstractNativeS3HAJobRunITCase::createConfiguration);
+    private static final 
AllCallbackWrapper<TestContainerExtension<SeaweedFsNativeS3TestContainer>>

Review Comment:
   Adding `@Test` there fails with a `ParameterResolutionException` rather than 
passing, but agreed that it isn't obvious. The override is gone: the CRT run is 
a separate class and the base test runs unchanged.



##########
flink-filesystems/flink-s3-fs-native/src/test/java/org/apache/flink/fs/s3native/NativeS3FileSystemITCase.java:
##########
@@ -29,20 +29,26 @@
 import org.apache.flink.core.testutils.AllCallbackWrapper;
 import org.apache.flink.core.testutils.TestContainerExtension;
 
-import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
 import org.junit.jupiter.params.provider.ValueSource;
 
 import java.net.URI;
 import java.nio.charset.StandardCharsets;
 import java.util.UUID;
+import java.util.stream.Stream;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatCode;
 
-/** Exercises native S3 filesystem operations directly. */
+/**
+ * Exercises native S3 filesystem operations directly. Tests that send 
requests run with the default

Review Comment:
   It does: every test that sends a request runs with `crt=false` and 
`crt=true`. Only `testMkdirsDoesNotThrowOnObjectStore` runs once, since 
`mkdirs` sends no request.



##########
flink-filesystems/flink-s3-fs-native/src/test/java/org/apache/flink/fs/s3native/metrics/NativeS3MetricsEmissionITCase.java:
##########
@@ -123,8 +123,6 @@ void 
realS3OperationsEmitFlinkMetrics(NativeS3FileSystemFactory factory, String
         config.set(NativeS3FileSystemFactory.SECRET_KEY, SECRET_KEY);
         config.set(NativeS3FileSystemFactory.REGION, "us-east-1");
         config.set(NativeS3FileSystemFactory.PATH_STYLE_ACCESS, true);
-        config.set(NativeS3FileSystemFactory.CHUNKED_ENCODING_ENABLED, false);
-        config.set(NativeS3FileSystemFactory.CHECKSUM_VALIDATION_ENABLED, 
false);

Review Comment:
   SeaweedFS needed them before 4.02. Since seaweedfs#7623 it supports 
aws-chunked uploads with trailing checksums, so the ITCases now run the default 
upload path.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to