This document describes the testing strategy and structure for this project.
We use a layered testing approach:
- Image Tests: Verify the container image itself (installed tools, versions, environment variables, file structure)
- Integration Tests: Verify that the container works correctly as a devcontainer (template initialization, configuration files, scripts, VS Code integration, sidecar)
- Utility / Script Tests: Unit and integration tests for repo scripts and utilities (e.g. install script, version check, build helpers)
The tests are organized as:
tests/
├── conftest.py # Shared fixtures for all tests
├── test_image.py # Container image verification tests
├── test_integration.py # Devcontainer integration tests (incl. sidecar)
├── test_release_cycle.py # Release cycle script tests (changelog, release)
└── test_utils.py # Utility and install script tests
These tests run against a running container instance to verify the image itself (installed tools, versions, environment variables, file structure).
TestSystemTools- git, curl, openssh-client, gh, justTestPythonEnvironment- Python 3.12, uvTestDevelopmentTools- pre-commit, ruff, justTestEnvironmentVariables- environment variablesTestFileStructure- file structure
These tests run against an initialized workspace to verify that the container works correctly as a devcontainer (template initialization, configuration files, scripts, VS Code integration, devcontainer deployment)
TestHostGitSignatureSetup- git commit signing prerequisites on hostTestDevContainerStructure- directory structureTestDevContainerJson- devcontainer.json validationTestDevContainerScripts- script existence/executabilityTestDevContainerPlaceholders- placeholder replacementTestDevContainerGit- git hooks/configTestDevContainerUserConf- user configuration filesTestDevContainerCLI- devcontainer deployment and functionalityTestSidecarConnectivity- sidecar container integration with just
Image and integration fixtures:
container_tag: Container tag fromTEST_CONTAINER_TAGenvironment variable (defaults to "dev")container_image: Full image name (e.g.ghcr.io/vig-os/devcontainer:dev)test_container: Running container instance for testing (session-scoped)host: Testinfra host connection to the container (session-scoped)initialized_workspace: Temporary workspace initialized withinit-workspacescript (session-scoped)devcontainer_up: Devcontainer set up using devcontainer CLI, ready for testing (session-scoped)devcontainer_with_sidecar: Devcontainer plus sidecar container for multi-container tests (session-scoped)sidecar_image: Built test sidecar image (session-scoped)
Note: Session-scoped fixtures (e.g. devcontainer_up, devcontainer_with_sidecar) are set up once per test session and reused. This is important for fixtures that take time to set up (e.g. devcontainer_up takes about a minute). Fixtures automatically clean up after all tests complete.
Tests are run using just recipes. The test recipe runs all test suites (image, integration, utils, version-check, install script):
# Run all test suites
just test
# Run tests for a specific image version (must be locally available)
just test version=1.0.0# Run only image tests (builds dev image if needed)
just test-image
# Run only integration tests (builds dev image if needed)
just test-integration
# Run only utility/script tests (no container required for test_utils)
just test-utils
just test-version-check
# Run sidecar integration tests (uses devcontainer_with_sidecar fixture)
just test-sidecar
# Run specific suite for a locally available version
just test-image version=1.0.0
just test-integration version=1.0.0test-imageandtest-integrationensure the dev image exists (built if needed whenversion=dev); they do not auto-update itTEST_CONTAINER_TAGis set from theversionparameter (default"dev")- Tests use pytest with verbose output (
-v) and short tracebacks (--tb=short) - See tests/CLEANUP.md for lingering container cleanup and
just clean-test-containers