test: add justfile commands for running integration tests with podman
Build / build (push) Successful in 43s

This commit is contained in:
2026-05-23 20:02:25 +02:00
parent 87a1a2d89a
commit 08f539abd9
2 changed files with 40 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
version: '3.8'
services:
test-db:
image: postgres:15-alpine
environment:
POSTGRES_USER: testuser
POSTGRES_PASSWORD: testpass
POSTGRES_DB: music_server_test
ports:
- "5433:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U testuser -d music_server_test"]
interval: 5s
timeout: 5s
retries: 5
volumes:
- test-db-data:/var/lib/postgresql/data
volumes:
test-db-data:
+19
View File
@@ -99,6 +99,25 @@ podman-run:
podman-down: podman-down:
@podman-compose down @podman-compose down
# Run integration tests with podman
# Starts a test PostgreSQL container, runs tests, then cleans up
test-integration:
@echo "Starting test database container..."
@podman-compose -f compose.test.yaml up -d
@sleep 10
@echo "Running integration tests..."
@. .env.test && go test -v -timeout 30m ./...
# Alternative: Run integration tests using testcontainers with podman provider
test-integration-tc:
@echo "Running integration tests with testcontainers (podman provider)..."
@TESTCONTAINERS_PROVIDER=podman go test -v -timeout 30m .
# Stop and remove test database container
test-integration-down:
@echo "Stopping test database container..."
@podman-compose -f compose.test.yaml down -v
# Create DB container # Create DB container
docker-run: docker-run:
@if docker compose up --build 2>/dev/null; then \ @if docker compose up --build 2>/dev/null; then \