Azure: Retry transient Azurite image-fetch failures in integration tests#16540
Open
wombatu-kun wants to merge 2 commits into
Open
Azure: Retry transient Azurite image-fetch failures in integration tests#16540wombatu-kun wants to merge 2 commits into
wombatu-kun wants to merge 2 commits into
Conversation
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…iner Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #16530.
The
iceberg-azureintegration tests (TestADLSFileIO,TestADLSInputStream,TestADLSOutputStream) start a shared Azurite container inAzuriteTestBase.@BeforeAll. They intermittently fail at startup with aContainerFetchExceptioncaused by aNotFoundException(HTTP 404) while testcontainers pullsmcr.microsoft.com/azure-storage/azurite:3.35.0. The image tag is already pinned, so this is a transient registry/CDN failure (rate-limiting or CDN inconsistency), not a missing image — re-running usually succeeds, which is exactly what makes these tests flaky.What changed
AzuriteContainernow overridesstart()to retry transient image-fetch failures before giving up: up to 5 attempts with exponential backoff (2s → 4s → 8s → 16s). Each retry re-invokesstart(), which re-triggers the image pull, because testcontainers'RemoteDockerImagedoes not cache a failed resolution.Notably, testcontainers' own
withStartupAttempts(...)does not help here: in testcontainers 2.0.5 the image is fetched (getDockerImageName()→RemoteDockerImage) before thestartupAttemptsretry loop inGenericContainer.doStart(), so a fetch failure short-circuits that loop. Retryingstart()itself is what actually re-attempts the pull.The retry is deliberately narrow: it only retries when the failure (or its cause chain) is a
ContainerFetchException. Genuine launch failures — e.g. a wait-strategy timeout surfaced as aContainerLaunchExceptionwithout a fetch cause — are rethrown immediately so real problems are never masked.Tests
TestAzuriteContainerexercises the retry helper without Docker: succeeds without retry, retries until success, rethrows after exhausting attempts, does not retry non-fetch launch failures, and retries a fetch failure wrapped in aContainerLaunchException.start()(TestADLSFileIO,TestADLSInputStream,TestADLSOutputStream) with Docker.Note
This reduces the flakiness by tolerating transient fetch hiccups; it cannot mask a registry outage that persists across all retries.