zentol commented on a change in pull request #18692:
URL: https://github.com/apache/flink/pull/18692#discussion_r804553091



##########
File path: 
flink-filesystems/flink-s3-fs-base/src/test/java/org/apache/flink/fs/s3/common/HAJobRunOnMinioS3StoreITCase.java
##########
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.fs.s3.common;
+
+import org.apache.flink.api.common.time.Deadline;
+import org.apache.flink.configuration.Configuration;
+import org.apache.flink.core.testutils.AllCallbackWrapper;
+import org.apache.flink.core.testutils.TestContainerExtension;
+import org.apache.flink.runtime.clusterframework.ApplicationStatus;
+import org.apache.flink.runtime.highavailability.AbstractHaJobRunITCase;
+import org.apache.flink.runtime.highavailability.JobResultStoreOptions;
+import org.apache.flink.runtime.testutils.CommonTestUtils;
+
+import org.apache.flink.shaded.guava30.com.google.common.collect.Iterables;
+
+import com.amazonaws.services.s3.model.S3ObjectSummary;
+import org.apache.commons.lang3.StringUtils;
+import org.junit.jupiter.api.extension.RegisterExtension;
+
+import java.time.Duration;
+import java.util.List;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * {@code HAJobRunOnMinioS3StoreITCase} covers a job run where the HA data is 
stored in Minio. The
+ * implementation verifies whether the {@code JobResult} was written into the 
FileSystem-backed
+ * {@code JobResultStore}.
+ */
+public abstract class HAJobRunOnMinioS3StoreITCase extends 
AbstractHaJobRunITCase {
+
+    private static final String CLUSTER_ID = "test-cluster";
+    private static final String JOB_RESULT_STORE_FOLDER = "jrs";
+
+    @RegisterExtension
+    private static final 
AllCallbackWrapper<TestContainerExtension<MinioTestContainer>>
+            MINIO_EXTENSION =
+                    new AllCallbackWrapper<>(new 
TestContainerExtension<>(MinioTestContainer::new));
+
+    private static MinioTestContainer getMinioContainer() {
+        return MINIO_EXTENSION.getCustomExtension().getTestContainer();
+    }
+
+    private static String createS3URIWithSubPath(String... subfolders) {
+        return getMinioContainer().getS3UriForDefaultBucket() + 
createSubPath(subfolders);
+    }
+
+    private static List<S3ObjectSummary> getObjectsFromJobResultStore() {
+        return getMinioContainer()
+                .getClient()
+                .listObjects(
+                        getMinioContainer().getDefaultBucketName(),
+                        createSubPath(CLUSTER_ID, JOB_RESULT_STORE_FOLDER))
+                .getObjectSummaries();
+    }
+
+    private static String createSubPath(String... subfolders) {
+        final String pathSeparator = "/";
+        return pathSeparator + StringUtils.join(subfolders, pathSeparator);
+    }
+
+    @Override
+    protected String getHAStoragePath() {
+        return createS3URIWithSubPath(CLUSTER_ID);
+    }
+
+    @Override
+    protected Configuration createConfiguration() {
+        final Configuration config = new Configuration();
+
+        getMinioContainer().setS3ConfigOptions(config);
+
+        // JobResultStore configuration
+        config.set(JobResultStoreOptions.DELETE_ON_COMMIT, Boolean.FALSE);
+        config.set(
+                JobResultStoreOptions.STORAGE_PATH,
+                createS3URIWithSubPath(CLUSTER_ID, JOB_RESULT_STORE_FOLDER));
+
+        return config;
+    }
+
+    @Override
+    protected void runAfterJobTermination() throws Exception {
+        final String jsonExtension = ".json";
+        final String dirtyJsonExtesion = "_DIRTY" + jsonExtension;

Review comment:
       Can we link this somehow to the JRS implementation? The FS module 
shouldn't have to know how the file is named etc.




-- 
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-unsubscr...@flink.apache.org

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


Reply via email to