metadata-ingestion-modules/airflow-plugin/README.docker.md
This directory contains a complete Docker-based test environment for the Airflow plugin.
Dockerfile.test - Docker image that runs tests via toxdocker-compose.test.yml - Docker Compose config with automatic volume mountsrun-tests.sh - Wrapper script for the easiest test experienceDOCKER_TEST_GUIDE.md - Complete documentation with examples# Run all tests
./run-tests.sh
# Run specific test
./run-tests.sh py311-airflow31 -- tests/integration/test_plugin.py::test_v2_basic_dag -v
# Update golden files (automatically saved to your local filesystem!)
./run-tests.sh py311-airflow31 -- --update-golden-files
Benefits:
-v flags)# Run all tests
docker compose -f docker-compose.test.yml run --rm airflow-plugin-test
# Update golden files
docker compose -f docker-compose.test.yml run --rm airflow-plugin-test
Both the wrapper script and Docker Compose automatically mount:
metadata-ingestion and airflow-plugin)tests/integration/goldens).tox directory - Docker Compose only)This means:
The Docker image uses tox to install all dependencies:
This ensures:
Test against any Airflow version in one image:
./run-tests.sh py310-airflow27 # Airflow 2.7
./run-tests.sh py311-airflow29 # Airflow 2.9
./run-tests.sh py311-airflow31 # Airflow 3.1
| Use Case | Recommended Approach |
|---|---|
| Local development | Local tox (faster iteration) |
| CI/CD pipelines | Docker (complete isolation) |
| Cross-platform testing | Docker (consistent environment) |
| Sharing test environment | Docker (works everywhere) |
| Testing on different OS | Docker (same Linux base) |
See DOCKER_TEST_GUIDE.md for:
# Wrapper Script (easiest)
./run-tests.sh # All tests
./run-tests.sh py311-airflow29 # Airflow 2.9
./run-tests.sh py311-airflow31 -- -k snowflake -v # Specific tests
./run-tests.sh py311-airflow31 -- --update-golden-files # Update golden files
REBUILD=true ./run-tests.sh # Force rebuild
# Docker Compose (recommended for CI/CD)
docker compose -f docker-compose.test.yml run --rm airflow-plugin-test
docker compose -f docker-compose.test.yml run --rm airflow-plugin-test py311-airflow29
docker compose -f docker-compose.test.yml build
# Docker CLI (most control)
docker build -f Dockerfile.test -t airflow-plugin-test ../../
docker run --rm airflow-plugin-test
docker run --rm airflow-plugin-test py311-airflow31 -- -v
tox.ini and test filesDOCKER_TEST_GUIDE.mdsetup.py and tox configuration