#9 Major routes refactor and expansion, #15 Added API for statistics, Added search cache backend and functionality tests, Backend sync improvements
Build / build (push) Successful in 56s
Build / build (push) Successful in 56s
This commit is contained in:
1 parent
e86c0f8e04
commit
a8a2602f50
34 files changed
+1819
-1294
No files matched your search
@@ -85,7 +85,7 @@ build-run: build
|
||||
|
||||
test: build
|
||||
@echo "Starting test database container..."
|
||||
@podman-compose -f compose.test.yaml up -d
|
||||
@docker compose -f compose.test.yaml up -d
|
||||
@sleep 10
|
||||
@echo "Running integration tests..."
|
||||
@just test-integration
|
||||
@@ -97,54 +97,75 @@ clean:
|
||||
@echo "Cleaning..."
|
||||
@rm -f main
|
||||
|
||||
podman-build:
|
||||
@echo "Building Docker image with podman..."
|
||||
@podman build -t music-server .
|
||||
docker-build:
|
||||
@echo "Building Docker image with docker..."
|
||||
@docker build -t music-server .
|
||||
|
||||
podman-run:
|
||||
@podman-compose up --build
|
||||
docker-run:
|
||||
@docker compose up --build
|
||||
|
||||
podman-down:
|
||||
@podman-compose down
|
||||
docker-down:
|
||||
@docker compose down
|
||||
|
||||
# Run integration tests with podman
|
||||
# Run integration tests with docker
|
||||
# Starts a test PostgreSQL container, runs tests, then cleans up
|
||||
test-integration:
|
||||
@echo "Cleaning old test database..."
|
||||
@podman-compose -f compose.test.yaml down -v
|
||||
@docker compose -f compose.test.yaml down -v
|
||||
@echo "Starting fresh test database container..."
|
||||
@podman-compose -f compose.test.yaml up -d
|
||||
@docker compose -f compose.test.yaml up -d
|
||||
@sleep 10
|
||||
@echo "Running integration tests..."
|
||||
@DB_HOST=localhost DB_PORT=5433 DB_USERNAME=testuser DB_PASSWORD=testpass DB_NAME=music_server_test MUSIC_PATH=/Users/sebastian/projects/MusicServer/testMusic CHARACTERS_PATH=/Users/sebastian/projects/MusicServer/testCharacters PORT=8081 LOG_LEVEL=debug LOG_JSON=false go test -v -timeout 30m -p 1 -parallel 1 ./internal/...
|
||||
@DOCKER_HOST=unix:///Users/sebastian/.docker/run/docker.sock TESTCONTAINERS_RYUK_CONTAINER_NETWORK=testcontainers-test-net DB_HOST=localhost DB_PORT=5433 DB_USERNAME=testuser DB_PASSWORD=testpass DB_NAME=music_server_test MUSIC_PATH=/Users/sebastian/projects/MusicServer/testMusic CHARACTERS_PATH=/Users/sebastian/projects/MusicServer/testCharacters PORT=8081 LOG_LEVEL=debug LOG_JSON=false go test -v -timeout 30m -p 1 -parallel 1 ./internal/...
|
||||
|
||||
# Alternative: Run integration tests using testcontainers with podman provider
|
||||
# Alternative: Run integration tests using testcontainers with docker provider
|
||||
test-integration-tc:
|
||||
@echo "Running integration tests with testcontainers (podman provider)..."
|
||||
@TESTCONTAINERS_PROVIDER=podman go test -v -timeout 30m .
|
||||
@echo "Creating test network (if it doesn't exist)..."
|
||||
@docker network inspect testcontainers-test-net > /dev/null 2>&1 || docker network create testcontainers-test-net
|
||||
@echo "Running integration tests with testcontainers (docker provider)..."
|
||||
@DOCKER_HOST=unix:///Users/sebastian/.docker/run/docker.sock TESTCONTAINERS_PROVIDER=docker TESTCONTAINERS_RYUK_CONTAINER_NETWORK=testcontainers-test-net go test -v -timeout 30m .
|
||||
|
||||
# Run SQL dump migration tests
|
||||
# Tests that the application can start with each SQL dump and migrations work correctly
|
||||
test-sql-dump:
|
||||
@echo "Creating test network (if it doesn't exist)..."
|
||||
@docker network inspect testcontainers-test-net > /dev/null 2>&1 || docker network create testcontainers-test-net
|
||||
@echo "Running SQL dump migration tests..."
|
||||
@DOCKER_HOST=unix:///Users/sebastian/.docker/run/docker.sock TESTCONTAINERS_PROVIDER=docker TESTCONTAINERS_RYUK_CONTAINER_NETWORK=testcontainers-test-net go test -v -timeout 15m -run "TestMusic.*Dump" ./internal/server/
|
||||
|
||||
# Run individual SQL dump tests
|
||||
test-sql-dump-ref:
|
||||
@echo "Creating test network (if it doesn't exist)..."
|
||||
@docker network inspect testcontainers-test-net > /dev/null 2>&1 || docker network create testcontainers-test-net
|
||||
@echo "Running SQL dump migration test for ref dump..."
|
||||
@DOCKER_HOST=unix:///Users/sebastian/.docker/run/docker.sock TESTCONTAINERS_PROVIDER=docker TESTCONTAINERS_RYUK_CONTAINER_NETWORK=testcontainers-test-net go test -v -timeout 5m -run "TestMusicRefDump" ./internal/server/
|
||||
|
||||
test-sql-dump-test:
|
||||
@echo "Creating test network (if it doesn't exist)..."
|
||||
@docker network inspect testcontainers-test-net > /dev/null 2>&1 || docker network create testcontainers-test-net
|
||||
@echo "Running SQL dump migration test for test dump..."
|
||||
@DOCKER_HOST=unix:///Users/sebastian/.docker/run/docker.sock TESTCONTAINERS_PROVIDER=docker TESTCONTAINERS_RYUK_CONTAINER_NETWORK=testcontainers-test-net go test -v -timeout 5m -run "TestMusicTestDump" ./internal/server/
|
||||
|
||||
test-sql-dump-prod:
|
||||
@echo "Creating test network (if it doesn't exist)..."
|
||||
@docker network inspect testcontainers-test-net > /dev/null 2>&1 || docker network create testcontainers-test-net
|
||||
@echo "Running SQL dump migration test for prod dump..."
|
||||
@DOCKER_HOST=unix:///Users/sebastian/.docker/run/docker.sock TESTCONTAINERS_PROVIDER=docker TESTCONTAINERS_RYUK_CONTAINER_NETWORK=testcontainers-test-net go test -v -timeout 5m -run "TestMusicProdDump" ./internal/server/
|
||||
|
||||
# Stop and remove test database container
|
||||
test-integration-down:
|
||||
@echo "Stopping test database container..."
|
||||
@podman-compose -f compose.test.yaml down -v
|
||||
@docker compose -f compose.test.yaml down -v
|
||||
|
||||
# Create DB container
|
||||
docker-run:
|
||||
@if docker compose up --build 2>/dev/null; then \
|
||||
: ; \
|
||||
else \
|
||||
echo "Falling back to Docker Compose V1"; \
|
||||
docker-compose up --build; \
|
||||
fi
|
||||
# Build and run with Docker Compose
|
||||
build-run-docker:
|
||||
@echo "Building and running with Docker Compose..."
|
||||
@docker compose up --build
|
||||
|
||||
# Shutdown DB container
|
||||
docker-down:
|
||||
@if docker compose down 2>/dev/null; then \
|
||||
: ; \
|
||||
else \
|
||||
echo "Falling back to Docker Compose V1"; \
|
||||
docker-compose down; \
|
||||
fi
|
||||
# Shutdown containers
|
||||
stop-docker:
|
||||
@echo "Stopping containers..."
|
||||
@docker compose down
|
||||
|
||||
watch-templ:
|
||||
templ generate --watch --proxy="http://localhost:8080" --cmd="go run ."
|
||||
|
||||
Reference in new issue
Block a user