yihua commented on code in PR #18772:
URL: https://github.com/apache/hudi/pull/18772#discussion_r3268688255
##########
hudi-azure/src/test/java/org/apache/hudi/azure/transaction/lock/ITAzureStorageLockClientAzurite.java:
##########
@@ -30,31 +30,46 @@
import com.azure.storage.blob.BlobContainerClient;
import com.azure.storage.blob.BlobServiceClient;
import com.azure.storage.blob.BlobServiceClientBuilder;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testcontainers.containers.ContainerFetchException;
+import org.testcontainers.containers.ContainerLaunchException;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.wait.strategy.Wait;
-import org.testcontainers.junit.jupiter.Container;
-import org.testcontainers.junit.jupiter.Testcontainers;
import org.testcontainers.utility.DockerImageName;
import java.time.Duration;
import java.util.Properties;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assumptions.abort;
/**
* Integration tests for {@link AzureStorageLockClient} using Azurite (Azure
Storage emulator).
*
* <p>Run with: {@code mvn -Pazure-integration-tests -pl hudi-azure verify}
+ *
+ * <p>If the Azurite Docker image cannot be pulled (Microsoft Container
Registry blocked,
+ * rate-limited, or network unavailable), the test class is skipped via {@link
+ * org.junit.jupiter.api.Assumptions#abort(String)} rather than failing the CI
run. Integration
+ * tests against external container images should not gate the overall build
on registry-side
+ * outages that are outside the project's control.
*/
-@Testcontainers(disabledWithoutDocker = true)
@DisabledIfEnvironmentVariable(named = "SKIP_AZURITE_IT", matches = "true")
public class ITAzureStorageLockClientAzurite {
+ private static final Logger LOG =
LoggerFactory.getLogger(ITAzureStorageLockClientAzurite.class);
Review Comment:
Use Lombok `@Slf4j` annotation to define the logger instead of the static
variable.
##########
hudi-azure/src/test/java/org/apache/hudi/azure/transaction/lock/ITAzureStorageLockClientAzurite.java:
##########
@@ -63,16 +78,50 @@ public class ITAzureStorageLockClientAzurite {
private static final String ACCOUNT_KEY =
"Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==";
- @Container
- public static final GenericContainer<?> AZURITE =
- new GenericContainer<>(AZURITE_IMAGE)
- .withExposedPorts(10000)
- .withCommand("azurite-blob", "--blobHost", "0.0.0.0", "--blobPort",
"10000", "--loose")
-
.waitingFor(Wait.forListeningPort().withStartupTimeout(Duration.ofSeconds(60)));
+ // Manual container lifecycle (instead of @Testcontainers + @Container) so
the test class is
+ // skipped — not failed — when the image cannot be pulled. The
@Testcontainers extension
+ // surfaces image-pull errors as test errors, which is the wrong outcome for
an external
+ // infrastructure failure (e.g. MCR returning HTTP 403 "request blocked" via
Azure WAF).
+ private static GenericContainer<?> azurite;
+
+ @BeforeAll
+ static void startAzurite() {
+ GenericContainer<?> container = new GenericContainer<>(AZURITE_IMAGE)
+ .withExposedPorts(10000)
+ .withCommand("azurite-blob", "--blobHost", "0.0.0.0", "--blobPort",
"10000", "--loose")
+
.waitingFor(Wait.forListeningPort().withStartupTimeout(Duration.ofSeconds(60)));
+ try {
+ container.start();
+ azurite = container;
+ } catch (ContainerFetchException | ContainerLaunchException e) {
+ // Image pull / container start failure. Most commonly caused by MCR
being unreachable
+ // or rate-limited from CI runners. Skip the suite rather than failing
the build.
+ LOG.warn("Azurite container unavailable; skipping suite. Cause: {}",
e.toString());
Review Comment:
Let's address this.
--
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]