forked from mtusi2026/mtusi2026lab3
На 5
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
SHELL := /bin/bash
|
||||
PYTHON ?= python3
|
||||
BASE_URL ?= http://localhost:8080
|
||||
BASE_URL ?= http://localhost:18080
|
||||
CA_FILE ?=
|
||||
ACTION_SCRIPT ?=
|
||||
TLS_ARGS = $(if $(CA_FILE),--ca-file "$(CA_FILE)",)
|
||||
@@ -11,7 +12,9 @@ OAPI_CODEGEN ?= $(shell go env GOPATH)/bin/oapi-codegen
|
||||
.PHONY: help check validate test load test-persistence test-failover openapi-generate certs key-gen
|
||||
|
||||
help:
|
||||
@echo "check: offline structure; validate: full OpenAPI (requirements-dev.txt); test: running API; load: synthetic writes"
|
||||
@echo "up/down: isolated lab3 stand; build/vet: Go checks; test/test-go/test-storage: API and atomicity"
|
||||
@echo "restart/restore/rolling-update: infrastructure actions; benchmark/research/saturation: experiments; analysis: report"
|
||||
@echo "check/validate: contracts; evidence: full acceptance with explicit restarts and replica failures"
|
||||
|
||||
check:
|
||||
$(PYTHON) scripts/check_contract.py
|
||||
@@ -57,3 +60,58 @@ gen-key:
|
||||
gen-crt:
|
||||
@openssl req -new -x509 -key ./certs/server.key -out ./certs/server.crt -days 365
|
||||
|
||||
|
||||
.PHONY: up down test-go
|
||||
up:
|
||||
./scripts/bootstrap.sh
|
||||
./scripts/compose.sh up -d --build --wait --wait-timeout 120
|
||||
|
||||
down:
|
||||
./scripts/compose.sh down
|
||||
|
||||
test-go:
|
||||
cd service && TEST_BASE_URL="$(BASE_URL)" go test -race -count=1 -v ./...
|
||||
|
||||
GO ?= go
|
||||
RATE ?= 100
|
||||
DURATION ?= 30s
|
||||
BENCH_ARGS ?=
|
||||
|
||||
.PHONY: build vet restart restore rolling-update benchmark research evidence test-storage
|
||||
build:
|
||||
cd service && $(GO) build ./...
|
||||
@mkdir -p bin
|
||||
cd service && $(GO) build -o ../bin/benchmark ./cmd/benchmark
|
||||
|
||||
vet:
|
||||
cd service && $(GO) vet ./...
|
||||
|
||||
restart:
|
||||
./scripts/restart.sh
|
||||
|
||||
restore:
|
||||
./scripts/compose.sh up -d --wait --wait-timeout 90 --no-recreate api lb
|
||||
|
||||
rolling-update:
|
||||
./scripts/rolling-update.sh
|
||||
|
||||
benchmark: build
|
||||
./bin/benchmark -base-url "$(BASE_URL)" -rate "$(RATE)" -duration "$(DURATION)" $(BENCH_ARGS)
|
||||
|
||||
research: build
|
||||
$(PYTHON) scripts/research.py --base-url "$(BASE_URL)"
|
||||
|
||||
evidence:
|
||||
$(PYTHON) scripts/acceptance.py --base-url "$(BASE_URL)"
|
||||
|
||||
test-storage:
|
||||
./scripts/test-storage.sh
|
||||
|
||||
.PHONY: analysis
|
||||
analysis:
|
||||
$(PYTHON) scripts/summarize-research.py
|
||||
$(PYTHON) scripts/write-report.py
|
||||
|
||||
.PHONY: saturation
|
||||
saturation: build
|
||||
$(PYTHON) scripts/saturation.py --base-url "$(BASE_URL)"
|
||||
|
||||
Reference in New Issue
Block a user