| name | cloud-integration-tests |
| description | Execute cloud provider integration tests for Google Cloud Platform (GCP) and Amazon Web Services (AWS), validate S3 and GCS operations, test cloud storage authentication, verify bucket access, and debug cloud integration issues. Use when testing cloud storage features, validating parallel upload/download operations, or troubleshooting cloud connectivity. |
Cloud Integration Tests
Tests integration with cloud storage providers (Google Cloud Platform and Amazon Web Services).
Prerequisites
Google Cloud Platform (GCP) Setup
Authenticate with GCP:
gcloud auth application-default login
gcloud config set project "your-project-id"
gcloud auth list
Amazon Web Services (AWS) Setup
Configure AWS credentials:
aws configure sso --use-device-code --profile default
aws sso login --use-device-code --profile default
aws sts get-caller-identity
Running Cloud Integration Tests
GCP Integration Tests
Execute GCP-specific tests:
TEST_GCP=true uv run pytest tests/integrations/gcs/
TEST_GCP=true uv run pytest tests/integrations/gcs/ -v
TEST_GCP=true uv run pytest tests/integrations/gcs/test_gcs_client.py::test_upload -v
Tests validate:
- Cloud Storage (GCS) authentication
- Bucket access and permissions
- File upload operations
- File download operations
- Directory listing
- Parallel worker handling
- Error recovery mechanisms
AWS Integration Tests
Execute AWS-specific tests:
TEST_AWS=true uv run pytest tests/integrations/s3/
TEST_AWS=true uv run pytest tests/integrations/s3/ -v
TEST_AWS=true uv run pytest tests/integrations/s3/test_s3_client.py::test_upload -v
Tests validate:
- S3 authentication and IAM
- Bucket operations (create, list, delete)
- Object upload/download
- Parallel processing with max_workers
- Network timeout handling
- Retry logic and error recovery
Combined Cloud Testing
Test both providers simultaneously:
TEST_GCP=true TEST_AWS=true uv run pytest tests/integrations/
TEST_GCP=true TEST_AWS=true uv run pytest tests/integrations/ -k "upload"
Cloud Storage Operations
S3 Upload with Parallel Processing
uv run maou hcpe-convert \
--input-path /path/to/records \
--input-format csa \
--output-s3 \
--bucket-name my-bucket \
--max-workers 8
Benefits:
- Parallel uploads (8 workers)
- Automatic retry on failure
- Progress tracking
GCS Upload with Parallel Processing
uv run maou hcpe-convert \
--input-path /path/to/records \
--input-format csa \
--output-gcs \
--bucket-name my-bucket \
--max-workers 8
S3 Download with Caching
uv run maou pre-process \
--input-s3 \
--input-bucket-name my-bucket \
--input-local-cache-dir ./cache \
--max-workers 16
Features:
- Local caching of downloaded files
- Parallel downloads (16 workers)
- Cache validation and reuse
GCS Download with Caching
uv run maou pre-process \
--input-gcs \
--input-bucket-name my-bucket \
--input-local-cache-dir ./cache \
--max-workers 16
Array Bundling for Efficiency
Bundle small numpy arrays for optimal I/O:
uv run maou pre-process \
--input-s3 \
--input-bucket-name my-bucket \
--input-local-cache-dir ./cache \
--input-enable-bundling \
--input-bundle-size-gb 1.0 \
--max-workers 16
uv run maou pre-process \
--input-gcs \
--input-bucket-name my-bucket \
--input-local-cache-dir ./cache \
--input-enable-bundling \
--input-bundle-size-gb 1.5 \
--max-workers 16
Benefits:
- Reduces file count from thousands to dozens
- ~1GB chunks easier to manage
- Memory mapping for efficient access
- Significantly faster data loading
Validation Checklist
Before running tests, verify:
Debugging Cloud Issues
Enable Debug Logging
export MAOU_LOG_LEVEL=DEBUG
TEST_GCP=true uv run pytest tests/integrations/gcs/ -v -s
uv run maou --debug-mode pre-process \
--input-s3 \
--input-bucket-name my-bucket
Common Issues
1. Authentication Failures
gcloud auth application-default login
aws sso login --use-device-code --profile default
2. Permission Denied
Check IAM roles:
- GCP: Need
storage.objects.create, storage.objects.get
- AWS: Need
s3:PutObject, s3:GetObject, s3:ListBucket
3. Network Timeouts
Increase timeout settings:
s3_client = S3Client(timeout=300)
4. Bucket Not Found
Verify bucket exists:
gsutil ls gs://my-bucket
aws s3 ls s3://my-bucket
Monitoring During Tests
GCP Cloud Console
Monitor operations in real-time:
AWS S3 Console
Monitor operations:
Performance Testing
Benchmark Cloud Operations
uv run maou utility benchmark-training \
--input-s3 \
--input-bucket-name my-bucket \
--input-local-cache-dir ./cache \
--sample-ratio 0.1 \
--gpu cuda:0
uv run maou utility benchmark-training \
--input-gcs \
--input-bucket-name my-bucket \
--input-local-cache-dir ./cache \
--sample-ratio 0.1 \
--gpu cuda:0
Metrics to observe:
- Download throughput (MB/s)
- Parallel worker efficiency
- Cache hit rate
- Network overhead
- End-to-end latency
Compare Bundled vs Non-Bundled
uv run maou utility benchmark-training \
--input-s3 \
--input-bucket-name my-bucket \
--gpu cuda:0
uv run maou utility benchmark-training \
--input-s3 \
--input-enable-bundling \
--input-bundle-size-gb 1.0 \
--gpu cuda:0
Expected improvement: 3-5x faster data loading with bundling.
Success Criteria
Cloud integration tests pass when:
- ✓ Authentication succeeds
- ✓ Bucket access verified
- ✓ Upload operations complete
- ✓ Download operations complete
- ✓ Parallel workers function correctly
- ✓ Error recovery works as expected
- ✓ Network timeouts are handled
- ✓ Cache validation succeeds
Test Coverage
Integration tests cover:
Core Functionality:
- Authentication and credential management
- Bucket operations (list, create, delete)
- Object operations (upload, download, delete)
- Parallel processing with multiple workers
Edge Cases:
- Network failures and retries
- Invalid credentials
- Non-existent buckets
- Permission errors
- Large file handling
Performance:
- Parallel upload throughput
- Parallel download throughput
- Cache efficiency
- Array bundling impact
When to Use
- Before deploying cloud-based training
- After cloud configuration changes
- When debugging cloud connectivity issues
- Before large-scale data transfers
- After updating cloud SDKs
- When validating new cloud features
- During performance optimization
References