Add comprehensive make target for E2E testing with MinIO setup and fresh builds
Summary
The current make test-e2e target requires significant manual setup (MinIO/storage, credentials, bucket creation, custom images) before running E2E tests. This creates friction for developers who want to quickly test changes with a complete environment.
Motivation
Currently, to run E2E tests with custom changes, developers must:
- Manually set up MinIO or external object storage
- Create and configure credentials files
- Create storage buckets
- Build and push container images separately
- Determine which test types (FSB, CSI, CSI Data Mover) are supported in their cluster
- Manage cleanup of test resources
This manual process is error-prone, time-consuming, and creates barriers to running comprehensive E2E tests during development.
Proposal
Add a new make target test-e2e-complete (or similar) that provides a complete E2E testing environment with intelligent test selection based on cluster capabilities.
Core Features
- Fresh Builds: Automatically builds Velero CLI and container image from current source
- MinIO Setup: Deploys MinIO in the current cluster context using AWS plugin as object store
- Intelligent Test Selection: Automatically detects and runs appropriate test types:
- File System Backup (FSB): Always available
- CSI Volume Snapshots: Runs if CSI drivers are detected (disabled on Kind clusters)
- CSI Data Mover: Runs if CSI snapshot capabilities are available (disabled on Kind clusters)
- Environment Validation: Checks cluster capabilities and sets up required components
- Label Support: Supports Ginkgo label filtering for focused testing
- Cleanup: Optional cleanup of test resources
Proposed Interface
# Run all supported E2E tests with fresh builds and MinIO setup
make test-e2e-complete
# Run specific test categories using labels
make test-e2e-complete GINKGO_LABELS="PriorityClass"
make test-e2e-complete GINKGO_LABELS="Basic && !Upgrade"
# Skip cleanup for debugging
make test-e2e-complete CLEANUP=false
# Override CSI detection (not recommended for Kind clusters)
make test-e2e-complete FORCE_CSI=true
make test-e2e-complete SKIP_CSI=trueImplementation Approach
The target would:
Build Phase:
- Build Velero CLI (
make local) - Build container image with unique tag for isolation
- Push to configurable registry (default: ttl.sh for ephemeral testing, chosen for its lack of credential setup requirements allowing any contributor to run tests)
- Build Velero CLI (
Environment Setup:
- Check cluster connectivity and current context
- Deploy/validate MinIO with AWS plugin configuration
- Create required storage buckets
- Generate AWS-compatible credentials for MinIO
Capability Detection:
- Detect cluster type (Kind, OpenShift, cloud providers)
- Determine supported test types:
- FSB: Always enabled (uses node-agent)
- CSI: Enabled if VolumeSnapshotClass resources exist AND not Kind cluster
- CSI Data Mover: Enabled if CSI + data movement capabilities detected AND not Kind cluster
- Configure test parameters accordingly
Test Execution:
- Run E2E tests with appropriate test types enabled
- Use fresh builds and MinIO object store
- Support existing GINKGO_LABELS filtering
- Provide comprehensive logging and capability reporting
Cleanup (optional):
- Remove test namespaces and resources
- Clean up temporary files and MinIO deployment
Test Type Configuration
The target would automatically configure test parameters based on detected capabilities:
# Example: Kind cluster detection
# - FSB: Always available
# - CSI: Disabled (Kind cluster detected, see issue #7507)
# - CSI Data Mover: Disabled (requires CSI support)
# Resulting test configuration for Kind:
--default-volumes-to-fs-backup=true # FSB tests
--use-volume-snapshots=false # CSI disabled on Kind
--snapshot-move-data=false # CSI Data Mover disabled
# Example: OpenShift/cloud cluster detection
# - FSB: Always available
# - CSI: Available (detected snapshot class + non-Kind cluster)
# - CSI Data Mover: Available (CSI + snapshot move data support)
# Resulting test configuration:
--default-volumes-to-fs-backup=true # FSB tests
--use-volume-snapshots=true # CSI tests
--snapshot-move-data=true # CSI Data Mover testsBenefits
- Developer Productivity: Single command for complete E2E testing
- Intelligent Testing: Automatically runs all supported test types based on cluster capabilities
- Reproducible Environments: Fresh builds and isolated resources
- CI/CD Ready: Self-contained for automated testing
- Platform Agnostic: Works correctly across different Kubernetes distributions
- Debugging Friendly: Optional cleanup and detailed capability reporting
- Contributor Friendly: Uses ttl.sh registry requiring no credential setup, allowing any contributor to run tests immediately
Example Use Cases
# Test priority class implementation (FSB only on Kind, all types on other clusters)
make test-e2e-complete GINKGO_LABELS="PriorityClass"
# Test backup workflows with automatic capability detection
make test-e2e-complete GINKGO_LABELS="Basic"
# Full test suite with debugging (preserves MinIO and test resources)
make test-e2e-complete CLEANUP=false DEBUG=true
# Override CSI detection (use with caution on Kind clusters)
make test-e2e-complete FORCE_CSI=true GINKGO_LABELS="CSI"Cluster Compatibility
| Platform | FSB | CSI | CSI Data Mover | Notes |
|---|---|---|---|---|
| Kind | ✅ | ❌ | ❌ | CSI disabled due to issue #7507 |
| OpenShift | ✅ | ✅ | ✅ | Full CSI support |
| EKS | ✅ | ✅ | ✅ | EBS CSI driver |
| GKE | ✅ | ✅ | ✅ | GCE PD CSI driver |
| AKS | ✅ | ✅ | ✅ | Azure Disk CSI driver |
Kind Cluster Detection
The implementation would detect Kind clusters using one or more of these methods:
- Check for Kind-specific node labels or annotations
- Examine cluster context name patterns (typically contains "kind")
- Detect Kind-specific storage classes or configurations
- Check kubectl context configuration
When Kind is detected, CSI-related tests would be automatically disabled with appropriate logging:
INFO: Kind cluster detected, disabling CSI tests (see https://github.com/vmware-tanzu/velero/issues/7507)
INFO: Running File System Backup (FSB) tests onlyImplementation Notes
- MinIO deployment should use appropriate storage classes and security contexts for the target platform
- Container registry should be configurable but default to ttl.sh (chosen specifically for its lack of credential setup requirements, enabling any contributor to run tests without registry configuration)
- Kind cluster detection should be robust and clearly logged
- CSI detection should check for both VolumeSnapshotClass and CSI driver availability on non-Kind clusters
- Should preserve existing
make test-e2ebehavior for compatibility - Error handling should gracefully degrade if certain capabilities aren't available
- Override flags should be available but discouraged for Kind clusters with appropriate warnings
This enhancement would significantly improve the developer experience for E2E testing by automatically configuring and running all supported backup and restore mechanisms while respecting platform limitations and removing credential barriers for contributors.
Source: velero-io/velero