yuqi1129 commented on code in PR #4232: URL: https://github.com/apache/gravitino/pull/4232#discussion_r1685898411
########## integration-test-common/src/test/java/org/apache/gravitino/integration/test/container/S3MockContainer.java: ########## @@ -0,0 +1,120 @@ +/* + * 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.gravitino.integration.test.container; + +import static java.lang.String.format; +import static org.testcontainers.shaded.org.awaitility.Awaitility.await; + +import com.google.common.collect.ImmutableSet; +import java.io.IOException; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import java.util.concurrent.TimeUnit; +import org.apache.hc.client5.http.classic.methods.HttpGet; +import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; +import org.apache.hc.client5.http.impl.classic.HttpClients; +import org.apache.hc.core5.http.ClassicHttpResponse; +import org.rnorth.ducttape.Preconditions; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.testcontainers.containers.Network; + +public class S3MockContainer extends BaseContainer { + private static final Logger LOGGER = LoggerFactory.getLogger(S3MockContainer.class); + public static final String DEFAULT_IMAGE = System.getenv("GRAVITINO_CI_S3MOCK_DOCKER_IMAGE"); + public static final String HOST_NAME = "gravitino-ci-s3mock"; + public static final int HTTP_PORT = 9090; + public static final int HTTPS_PORT = 9191; + + protected S3MockContainer( + String image, + String hostName, + Set<Integer> ports, + Map<String, String> extraHosts, + Map<String, String> filesToMount, + Map<String, String> envVars, + Optional<Network> network) { + super(image, hostName, ports, extraHosts, filesToMount, envVars, network); + } + + @Override + protected void setupContainer() { + super.setupContainer(); + withLogConsumer(new PrintingContainerLog(format("%-14s| ", "S3MockContainer"))); + } + + @Override + public void start() { + super.start(); + Preconditions.check("S3Mock container startup failed!", checkContainerStatus(5)); + } + + @Override + protected boolean checkContainerStatus(int retryLimit) { + String endpoint = String.format("http://%s:%s/", getContainerIpAddress(), HTTP_PORT); + + await() + .atMost(30, TimeUnit.SECONDS) + .pollInterval(30 / retryLimit, TimeUnit.SECONDS) + .until( + () -> { + try (CloseableHttpClient httpClient = HttpClients.createDefault()) { Review Comment: The method `isHttpServerUp` may meet your requirement. ########## catalogs/catalog-hadoop/build.gradle.kts: ########## @@ -40,6 +40,7 @@ dependencies { exclude("javax.servlet", "servlet-api") } implementation(libs.hadoop3.client) + implementation(libs.hadoop3.aws) Review Comment: Please sort in alphabetical order. -- 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]
