MartijnVisser commented on code in PR #29819: URL: https://github.com/apache/flink/pull/29819#discussion_r4535783780
########## flink-filesystems/flink-gs-fs-hadoop/src/test/java/org/apache/flink/fs/gs/HadoopGSRecoverableWriterExceptionITCase.java: ########## @@ -0,0 +1,53 @@ +/* + * 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.gs; + +import org.apache.flink.configuration.Configuration; +import org.apache.flink.core.fs.FileSystem; +import org.apache.flink.core.fs.Path; +import org.apache.flink.runtime.fs.hdfs.AbstractHadoopRecoverableWriterExceptionITCase; + +import org.junit.jupiter.api.BeforeAll; + +import java.io.IOException; +import java.util.UUID; + +import static org.assertj.core.api.Assertions.assertThat; + +/** + * Integration tests for exception handling in {@link + * org.apache.flink.fs.gs.writer.GSRecoverableWriter}. + */ +class HadoopGSRecoverableWriterExceptionITCase + extends AbstractHadoopRecoverableWriterExceptionITCase { Review Comment: Yes, on a real bucket `testExceptionWritingAfterCloseForCommit` left its uncommitted object under `.inprogress/` on every run. Both GCS suites now delete that prefix in an `@AfterAll`, nothing is left there afterwards. ########## flink-filesystems/flink-gs-fs-hadoop/src/test/java/org/apache/flink/fs/gs/HadoopGSRecoverableWriterITCase.java: ########## @@ -0,0 +1,72 @@ +/* + * 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.gs; + +import org.apache.flink.configuration.Configuration; +import org.apache.flink.core.fs.FileSystem; +import org.apache.flink.core.fs.Path; +import org.apache.flink.core.fs.RecoverableWriter; +import org.apache.flink.runtime.fs.hdfs.AbstractHadoopRecoverableWriterITCase; + +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.io.IOException; +import java.util.UUID; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; + +/** Integration tests for {@link org.apache.flink.fs.gs.writer.GSRecoverableWriter}. */ +class HadoopGSRecoverableWriterITCase extends AbstractHadoopRecoverableWriterITCase { + + @BeforeAll + static void setup() throws IOException { + GSTestCredentials.assumeCredentialsAvailable(); + FileSystem.initialize(new Configuration(), null); + basePath = new Path(GSTestCredentials.getTestBucketUri() + "tests-" + UUID.randomUUID()); + assertThat(basePath.getFileSystem().exists(basePath)).isFalse(); + bigDataChunk = createBigDataChunk(BIG_CHUNK_DATA_PATTERN, 7L << 20); Review Comment: They didn't: the default chunk size is 16 MiB, so each 7 MiB component went up in one request. With `gs.writer.chunk.size` at 256kb it is now 29 chunks per component. ########## flink-filesystems/flink-hadoop-fs/src/test/java/org/apache/flink/runtime/fs/hdfs/AbstractHadoopRecoverableWriterITCase.java: ########## @@ -181,7 +195,7 @@ void testCommitAfterPersist() throws Exception { } @Test - void testCleanupRecoverableState() throws Exception { + public void testCleanupRecoverableState() throws Exception { Review Comment: The GCS test overrides both to disable them, and a package-private method can't be overridden from another package. `protected` is enough, changed it. We could also skip them in the base when `requiresCleanupOfRecoverableState()` is false, if you prefer that. ########## flink-filesystems/flink-hadoop-fs/src/test/java/org/apache/flink/runtime/fs/hdfs/AbstractHadoopRecoverableWriterITCase.java: ########## @@ -129,8 +141,10 @@ void cleanupAndCheckTmpCleanup() throws Exception { assertThat(files).isEmpty(); } Files.delete(localTmpDir); + } - // delete also object store dir. + @AfterEach Review Comment: Right, the order isn't defined. They didn't depend on each other, but I merged them back into one with the object store delete in a `finally`, so it still runs when the tmp dir check fails. ########## flink-filesystems/flink-gs-fs-hadoop/src/test/java/org/apache/flink/fs/gs/HadoopGSRecoverableWriterITCase.java: ########## @@ -0,0 +1,72 @@ +/* + * 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.gs; + +import org.apache.flink.configuration.Configuration; +import org.apache.flink.core.fs.FileSystem; +import org.apache.flink.core.fs.Path; +import org.apache.flink.core.fs.RecoverableWriter; +import org.apache.flink.runtime.fs.hdfs.AbstractHadoopRecoverableWriterITCase; + +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.io.IOException; +import java.util.UUID; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; + +/** Integration tests for {@link org.apache.flink.fs.gs.writer.GSRecoverableWriter}. */ +class HadoopGSRecoverableWriterITCase extends AbstractHadoopRecoverableWriterITCase { + + @BeforeAll + static void setup() throws IOException { + GSTestCredentials.assumeCredentialsAvailable(); + FileSystem.initialize(new Configuration(), null); + basePath = new Path(GSTestCredentials.getTestBucketUri() + "tests-" + UUID.randomUUID()); + assertThat(basePath.getFileSystem().exists(basePath)).isFalse(); + bigDataChunk = createBigDataChunk(BIG_CHUNK_DATA_PATTERN, 7L << 20); + skipped = false; + } + + @Test + @Override + @Disabled("This test is not meaningful. GSRecoverableWriter#cleanupRecoverableState is no-op.") + public void testCleanupRecoverableState() {} + + @Test + @Override + @Disabled("This test assumes one file for state, but GSRecoverableWriter uses multiple files.") + public void testCallingDeleteObjectTwiceDoesNotThroughException() {} + + @Override + protected String getLocalTmpDir() throws Exception { Review Comment: It is already abstract in the parent, I'd keep it that way. S3 and OSS stage data locally, and a `null` default would let a new subclass skip the tmp dir check without noticing. -- 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]
