Собрать стенд из API, PostgreSQL и Valkey с хуком перезапуска
This commit is contained in:
@@ -28,12 +28,9 @@ test-persistence:
|
||||
# ---------------------------------------------------------------------------
|
||||
# Application targets (Go implementation). The targets above are the skeleton.
|
||||
# ---------------------------------------------------------------------------
|
||||
IMAGE ?= mtusi-messenger:lab2
|
||||
CONTAINER ?= mtusi-messenger-lab2
|
||||
PUBLISH ?= 127.0.0.1:8080
|
||||
EVIDENCE_DIR ?= evidence
|
||||
|
||||
.PHONY: build vet unit up down docker-build docker-run docker-stop docker-logs wait-ready concurrency lifecycle
|
||||
.PHONY: build vet unit secrets up down destroy logs concurrency explain
|
||||
|
||||
build:
|
||||
go build -o bin/server ./cmd/server
|
||||
@@ -41,32 +38,29 @@ build:
|
||||
vet:
|
||||
go vet ./...
|
||||
|
||||
# The tests start disposable PostgreSQL and Valkey containers: Docker must run.
|
||||
unit:
|
||||
go test -race -count=1 ./...
|
||||
|
||||
secrets:
|
||||
sh scripts/init-secrets.sh
|
||||
|
||||
up:
|
||||
docker compose up -d --build --wait
|
||||
|
||||
# Stops and removes the containers; volumes and therefore data are kept.
|
||||
down:
|
||||
docker compose down
|
||||
|
||||
docker-build:
|
||||
docker build -t "$(IMAGE)" .
|
||||
# Deletes the volumes too: every user, chat, message and session of the stand.
|
||||
destroy:
|
||||
docker compose down -v
|
||||
|
||||
docker-run:
|
||||
docker run -d --name "$(CONTAINER)" -p "$(PUBLISH):8080" --env-file .env "$(IMAGE)"
|
||||
|
||||
docker-stop:
|
||||
docker stop -t 10 "$(CONTAINER)" && docker rm "$(CONTAINER)"
|
||||
|
||||
docker-logs:
|
||||
docker logs "$(CONTAINER)"
|
||||
|
||||
wait-ready:
|
||||
BASE_URL="$(BASE_URL)" sh student-tests/wait-ready.sh
|
||||
logs:
|
||||
docker compose logs
|
||||
|
||||
concurrency:
|
||||
go run ./tools/concurrency --base-url "$(BASE_URL)" --output "$(EVIDENCE_DIR)/concurrency.json"
|
||||
|
||||
lifecycle:
|
||||
BASE_URL="$(BASE_URL)" CONTAINER="$(CONTAINER)" sh student-tests/lifecycle.sh
|
||||
explain:
|
||||
docker compose exec -T postgres psql -U messenger -d messenger -X -q -v ON_ERROR_STOP=1 -f - < scripts/explain-history.sql
|
||||
|
||||
Reference in New Issue
Block a user