forked from mtusi2026/mtusi2026lab4
feat: add 4 grade things
This commit is contained in:
@@ -1,23 +1,37 @@
|
||||
PYTHON ?= python3
|
||||
BASE_URL ?= http://localhost:8080
|
||||
CA_FILE ?=
|
||||
# Configuration
|
||||
PYTHON ?= python3
|
||||
BASE_URL ?= http://localhost:8080
|
||||
CA_FILE ?=
|
||||
ACTION_SCRIPT ?=
|
||||
COMPOSE = docker compose --project-name highload-lab4 --env-file .env -f compose.yml
|
||||
CLEANUP_ARGS ?= --dry-run
|
||||
|
||||
COMPOSE = docker compose --project-name highload-lab4 --env-file .env -f compose.yml
|
||||
TLS_ARGS = $(if $(CA_FILE),--ca-file "$(CA_FILE)",)
|
||||
|
||||
.PHONY: help check validate test load test-persistence test-failover test-grade3 test-grade3-failures
|
||||
.PHONY: app-init app-build app-up app-start app-stop app-down app-restart app-logs app-status test-backend test-baseline test-baseline-persistence
|
||||
.PHONY: \
|
||||
help \
|
||||
app-init app-build app-up app-start app-stop app-down app-restart app-logs app-status \
|
||||
attachments-cleanup \
|
||||
check validate test load test-persistence test-failover \
|
||||
test-backend test-baseline test-baseline-persistence test-grade3 test-grade3-failures \
|
||||
test-attachment-validation test-attachment-access test-upload-recovery test-attachment-cleanup test-s3-permissions test-upload-memory
|
||||
|
||||
|
||||
|
||||
help:
|
||||
@echo "app-build: build application images; app-up: build and start the full stack"
|
||||
@echo "app-start: start without rebuilding; app-stop: stop and keep containers"
|
||||
@echo "app-down: remove containers and networks, keeping data volumes"
|
||||
@echo "app-restart: restart the stack; app-logs / app-status: inspect services"
|
||||
@echo "test-attachment-validation / test-attachment-access / test-upload-recovery / test-attachment-cleanup / test-s3-permissions"
|
||||
@echo "test-upload-memory: 10-client memory experiment; attachments-cleanup: dry run (CLEANUP_ARGS= to apply)"
|
||||
@echo "test-grade3 / test-grade3-failures: attachment checks; second target temporarily stops this stack services"
|
||||
@echo "test-backend: Go race tests; test-baseline: transferred API checks"
|
||||
@echo "test-baseline-persistence: transferred API checks across a restart"
|
||||
@echo "check: offline structure; validate: full OpenAPI (requirements-dev.txt); test: running API; load: synthetic writes"
|
||||
|
||||
|
||||
|
||||
app-init:
|
||||
$(PYTHON) scripts/init_env.py
|
||||
chmod +x scripts/restart.sh scripts/stop-one.sh
|
||||
@@ -46,20 +60,12 @@ app-logs:
|
||||
app-status:
|
||||
$(COMPOSE) ps --all
|
||||
|
||||
test-backend: app-init
|
||||
$(COMPOSE) --profile test run --build --rm backend-tests
|
||||
|
||||
test-baseline:
|
||||
$(PYTHON) scripts/check_baseline.py --base-url "$(BASE_URL)"
|
||||
|
||||
test-baseline-persistence:
|
||||
$(PYTHON) scripts/check_baseline.py --base-url "$(BASE_URL)" --restart
|
||||
attachments-cleanup:
|
||||
$(COMPOSE) run --rm --no-deps upload-cleanup ./messenger attachments-cleanup $(CLEANUP_ARGS)
|
||||
|
||||
test-grade3:
|
||||
$(PYTHON) scripts/check_grade3.py --base-url "$(BASE_URL)"
|
||||
|
||||
test-grade3-failures:
|
||||
$(PYTHON) scripts/check_grade3.py --base-url "$(BASE_URL)" --failures
|
||||
|
||||
check:
|
||||
$(PYTHON) scripts/check_contract.py
|
||||
@@ -80,3 +86,41 @@ test-persistence:
|
||||
test-failover:
|
||||
@test -n "$(ACTION_SCRIPT)" || (echo "Set ACTION_SCRIPT to your implemented executable stop-one hook"; exit 2)
|
||||
$(PYTHON) tests/resilience.py --mode failover --action-script "$(ACTION_SCRIPT)" --base-url "$(BASE_URL)" $(TLS_ARGS)
|
||||
|
||||
|
||||
|
||||
test-backend: app-init
|
||||
$(COMPOSE) --profile test run --build --rm backend-tests
|
||||
|
||||
test-baseline:
|
||||
$(PYTHON) scripts/check_baseline.py --base-url "$(BASE_URL)"
|
||||
|
||||
test-baseline-persistence:
|
||||
$(PYTHON) scripts/check_baseline.py --base-url "$(BASE_URL)" --restart
|
||||
|
||||
test-grade3:
|
||||
$(PYTHON) scripts/check_grade3.py --base-url "$(BASE_URL)"
|
||||
|
||||
test-grade3-failures:
|
||||
$(PYTHON) scripts/check_grade3.py --base-url "$(BASE_URL)" --failures
|
||||
|
||||
|
||||
|
||||
test-attachment-validation: app-init
|
||||
$(COMPOSE) --profile test run --build --rm backend-tests go test -race -count=1 -v ./backend/tests -run '^TestAttachment(ImageValidation|FilenameValidation|ValidationHTTP|MessageRequiresStringText)$$'
|
||||
|
||||
test-attachment-access: app-init
|
||||
$(COMPOSE) --profile test run --build --rm backend-tests go test -race -count=1 -v ./backend/tests -run '^TestAttachmentAccess'
|
||||
|
||||
test-upload-recovery: app-init
|
||||
$(COMPOSE) --profile test run --build --rm backend-tests go test -race -count=1 -v ./backend/tests -run '^TestUpload(Recovery|CrashHelper)'
|
||||
|
||||
test-attachment-cleanup: app-init
|
||||
$(COMPOSE) --profile test run --build --rm backend-tests go test -race -count=1 -v ./backend/tests -run '^TestAttachmentCleanup'
|
||||
|
||||
test-s3-permissions: app-init
|
||||
$(COMPOSE) --profile test run --build --rm backend-tests go test -race -count=1 -v ./backend/tests -run '^TestS3Permissions'
|
||||
$(PYTHON) scripts/check_s3_isolation.py
|
||||
|
||||
test-upload-memory:
|
||||
$(PYTHON) scripts/check_upload_memory.py
|
||||
|
||||
Reference in New Issue
Block a user