Repository navigation
DOCKER_TESTING
github-actions[bot] edited this page Oct 16, 2025
·
1 revision
- Install Docker Desktop for Windows: https://www.docker.com/products/docker-desktop/
- Ensure Docker is running (check system tray)
# Build and run all tests
docker-compose up painlessmesh-test
# Or using plain Docker
docker build -t painlessmesh-test .
docker run --rm -v ${PWD}:/workspace painlessmesh-test# Start interactive shell
docker-compose run --rm painlessmesh-dev
# Inside the container, you can:
cmake -G Ninja .
ninja
./bin/catch_mqtt_bridge
./bin/catch_alteriom_packages
# etc.docker-compose builddocker-compose run --rm painlessmesh-test ./bin/catch_mqtt_bridgedocker-compose up painlessmesh-testdocker-compose down -vdocker-compose build --no-cache
docker-compose up painlessmesh-testname: Test with Docker
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build and Test
run: |
docker build -t painlessmesh-test .
docker run --rm painlessmesh-testCreate test.ps1:
#!/usr/bin/env pwsh
Write-Host "Building Docker image..." -ForegroundColor Cyan
docker build -t painlessmesh-test .
Write-Host "`nRunning tests..." -ForegroundColor Cyan
docker run --rm painlessmesh-test
if ($LASTEXITCODE -eq 0) {
Write-Host "`n✅ All tests passed!" -ForegroundColor Green
} else {
Write-Host "`n❌ Tests failed!" -ForegroundColor Red
exit 1
}Run with: .\test.ps1
Error: Cannot connect to the Docker daemon
Solution: Start Docker Desktop from Windows Start Menu
If you see port binding errors, stop conflicting containers:
docker ps
docker stop <container_id>Clean up unused images and containers:
docker system prune -aForce rebuild without cache:
docker-compose build --no-cacheThe Docker environment runs all Catch2 tests:
- ✅
catch_mqtt_bridge- MQTT command routing and parameter parsing - ✅
catch_alteriom_packages- Alteriom package serialization - ✅
catch_protocol- Protocol validation - ✅
catch_router- Mesh routing logic - ✅
catch_plugin- Plugin system - ✅ And all other
catch_*.cpptests
- Consistent Environment - Same results on all machines
- No Local Installation - No need for CMake, Ninja, compilers
- CI/CD Ready - Same container in development and CI
- Isolated - Doesn't affect your Windows installation
- Reproducible - Anyone can run tests identically
Install the "Docker" extension, then you can:
- Right-click
Dockerfile→ "Build Image" - Right-click
docker-compose.yml→ "Compose Up" - View logs in VS Code terminal
$env:DOCKER_BUILDKIT=1
docker build -t painlessmesh-test .docker run --rm -v ${PWD}:/workspace painlessmesh-testThis way, changes to source files don't require rebuilding the image.
docker-compose run --rm painlessmesh-test bash -c "cmake -G Ninja . && ninja && ./bin/catch_mqtt_bridge"docker-compose run --rm painlessmesh-dev
# Inside container:
cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug .
ninja
gdb ./bin/catch_mqtt_bridgeAdd to Dockerfile:
RUN apt-get update && apt-get install -y valgrindThen run:
docker-compose run --rm painlessmesh-test valgrind ./bin/catch_mqtt_bridge