Test CLI Reference
Complete command-line interface reference for the Garden Linux test runner (./test).
Overview
The main entry point is ./test in the Garden Linux root directory (symlink to tests/util/run.sh). It automatically detects the image type and runs appropriate tests.
Basic Syntax:
./test [OPTIONS] <image-file>Common Options
--help
Show help message and exit.
./test --help--skip-cleanup
Skip cleanup of cloud resources after testing.
QEMU VM behavior:
- After running or skipping tests, stop and cleanup the VM with
ctrl + c.
Cloud behavior:
- To clean up cloud resources after using this flag, re-run without the flag or use
--only-cleanup.
./test --skip-cleanup .build/image.raw--skip-tests
Skip running the actual test suite (useful for infrastructure setup only).
./test --skip-tests .build/image.raw--test-args
Pass any command-line argument to pytest. Put multiple arguments inside quotes.
Examples:
Run a specific test file:
./test --test-args "test_ssh.py" .build/image.rawRun with verbose output:
./test --test-args "-v" .build/image.rawRun multiple tests:
./test --test-args "test_ssh.py test_network.py -v" .build/image.rawEnable debug logging:
./test --test-args "--log-cli-level=DEBUG" .build/image.rawCloud-Specific Options
--cloud <provider>
Specify cloud provider (aws, gcp, azure, ali, openstack).
./test --cloud aws .build/image.raw
./test --cloud gcp .build/image.raw
./test --cloud azure .build/image.raw
./test --cloud ali .build/image.raw
./test --cloud openstack .build/image.rawINFO
QEMU VM testing ignores this flag.
--cloud-image
Use an existing cloud image instead of uploading a new one.
Possible images are listed on official releases, for example 1592.12:
- ali:
m-d7o7skltl4qe9anmwdp4(eu-west-1 amd64) - aws:
ami-0d8d06eb3a44ae794(eu-central-1 amd64) - gcp:
gardenlinux-gcp-ff804026cbe7b5f2d6f729e4-1592-12-c6d7f9a9(amd64) - azure:
/CommunityGalleries/gardenlinux-13e998fe-534d-4b0a-8a27-f16a73aef620/Images/gardenlinux-nvme-gen2/Versions/1592.12.0(amd64)
./test --cloud aws --cloud-image ami-0d8d06eb3a44ae794--image-requirements-file <file>
Only needed with --cloud-image. Points to a valid *.requirements file.
./test --cloud aws --cloud-image \
--image-requirements-file .build/aws-gardener_prod-amd64-today-local.requirements \
ami-07f977508ed36098e--only-cleanup
Only run tofu destroy for cloud setups (cleans up resources without running tests).
./test --cloud aws --only-cleanup .build/image.raw--cloud-plan
Only run tofu plan for cloud setups (shows what resources would be created without creating them).
./test --cloud aws --cloud-plan .build/image.rawINFO
QEMU VM testing ignores this flag.
QEMU-Specific Options
--ssh
Enable SSH access to QEMU VM (gardenlinux@127.0.0.1:2222).
./test --ssh .build/image.rawINFO
For cloud testing, SSHD is always enabled via cloud-init.
--debug
Enable debug mode (display window) for QEMU VM.
./test --debug .build/image.rawShows a graphical window with the QEMU VM console output.
Development Options
--dev
Enable development mode with automatic file synchronization and test re-execution.
QEMU shorthand for:
--ssh --skip-cleanup --skip-tests --watchCloud shorthand for:
--skip-cleanup --skip-tests --watchUsage:
# QEMU dev mode
./test --dev .build/image.raw
# Cloud dev mode
./test --dev --cloud aws .build/image.raw
# With specific tests
./test --dev --test-args "test_ssh.py -v" .build/image.rawWhat it does:
- Starts VM (QEMU or cloud)
- Syncs test distribution
- Runs tests once
- Watches for file changes in
tests/andfeatures/ - Re-syncs and re-runs tests on changes
- Stop with
Ctrl+C
--watch
Watch for file changes and re-run tests automatically (used internally by --dev).
./test --ssh --skip-cleanup --skip-tests --watch .build/image.rawImage Types
The test runner automatically detects the image type based on the file extension:
.tar files - Chroot testing:
./test .build/image.tar.raw files - QEMU or cloud testing:
# QEMU (default)
./test .build/image.raw
# Cloud (with --cloud flag)
./test --cloud aws .build/image.raw.oci files - OCI container testing:
./test .build/container-amd64-today-local.ociExamples
Basic Testing
Run chroot tests:
./test .build/image.tarRun QEMU tests:
./test .build/image.rawRun cloud tests:
./test --cloud aws .build/image.rawDevelopment Workflow
Run QEMU with SSH and keep running:
./test --ssh --skip-cleanup .build/image.rawUse dev mode for rapid iteration:
./test --dev --test-args "test_ssh.py -v" .build/image.rawSpecific Test Execution
Run only SSH tests:
./test --test-args "test_ssh.py" .build/image.rawRun tests with verbose output:
./test --test-args "-v" .build/image.rawRun multiple specific tests:
./test --test-args "test_ssh.py test_network.py -v" .build/image.rawCloud Testing
Test on AWS with cleanup:
./test --cloud aws .build/image.rawTest on AWS, keep resources for inspection:
./test --cloud aws --skip-cleanup .build/image.rawClean up resources later:
./test --cloud aws --only-cleanup .build/image.rawTest existing cloud image:
./test --cloud aws --skip-cleanup --skip-tests --cloud-image \
--image-requirements-file .build/aws-gardener_prod-amd64-today-local.requirements \
ami-07f977508ed36098eDebugging
Enable debug logging:
./test --test-args "--log-cli-level=DEBUG" .build/image.rawRun specific test with debug logging:
./test --test-args "--log-cli-level=DEBUG test_ssh.py" .build/image.rawShow QEMU debug window:
./test --debug .build/image.rawInfrastructure Only
Set up infrastructure without running tests:
./test --skip-tests .build/image.rawPlan cloud resources without creating them:
./test --cloud aws --cloud-plan .build/image.rawOption Combinations
Common option combinations:
Local development:
./test --ssh --skip-cleanup .build/image.rawRapid iteration:
./test --dev --test-args "test_ssh.py -v" .build/image.rawCloud inspection:
./test --cloud aws --skip-tests --skip-cleanup .build/image.rawSpecific test in cloud:
./test --cloud aws --skip-cleanup --test-args "test_ssh.py -v" .build/image.rawDebug mode with SSH:
./test --ssh --debug --skip-cleanup .build/image.rawExit Codes
The test runner returns standard pytest exit codes:
0- All tests passed1- Tests failed2- Test execution was interrupted3- Internal error during test execution4- pytest command-line usage error5- No tests were collected