Fix flaky TestStorageProviderUploadDownload integration test#22
Merged
Conversation
Enhanced the Docker Compose setup for integration tests to handle transient failures and port conflicts: - Add retry logic (3 attempts) for starting services - Implement exponential backoff between retries - Add 2-second wait after cleanup for port release - Improve logging at each setup step This fixes flaky test failures caused by port conflicts when containers from previous test runs haven't fully cleaned up.
Refactored TestStorageProviderUploadDownload to improve test
reliability and add stability testing capability:
- Extract test logic into reusable helper function
- Add TestStorageProviderUploadDownloadStability for multi-iteration testing
- Add 50ms stabilization wait after upload
- Improve error messages with detailed data comparison
- Make stability test opt-in via RUN_STABILITY_TESTS environment variable
- Support configurable iterations via STABILITY_TEST_ITERATIONS
The stability test helps identify race conditions and timing issues
by running the same test multiple times. It's skipped by default
but can be enabled for debugging flaky test behavior.
Usage:
# Run regular test
go test -v -run TestStorageProviderUploadDownload
# Run stability test with 10 iterations
RUN_STABILITY_TESTS=1 STABILITY_TEST_ITERATIONS=10 \
go test -v -run TestStorageProviderUploadDownloadStability
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
Fixes the flaky
TestStorageProviderUploadDownloadintegration test by improving Docker Compose setup and adding an integrated stability testing capability.Problem
The integration test was failing due to port conflicts when Docker containers from previous test runs hadn't fully cleaned up. Port 5556 (used by the dex service) was being held by gvproxy even after
docker compose down, causing subsequent test runs to fail with "address already in use" errors.Test Results Before Fix:
Solution
1. Improved Docker Compose Setup (
testing/integration_test.go)2. Refactored Storage Test with Stability Testing (
testing/storage_integration_test.go)TestStorageProviderUploadDownloadStabilityfor multi-iteration testingRUN_STABILITY_TESTSenvironment variableTest Results After Fix
Regular Test:
Stability Test:
Benefits
Usage