add async with all functions

This commit is contained in:
2026-10-23 00:20:58 +03:00
parent a85702a30e
commit 7b7ca1b888
42 changed files with 901 additions and 763 deletions
+6 -8
View File
@@ -1,19 +1,21 @@
-include .env
PYTHON ?= python3
BASE_URL ?= http://localhost:8080
CA_FILE ?=
ACTION_SCRIPT ?=
TLS_ARGS = $(if $(CA_FILE),--ca-file "$(CA_FILE)",)
TEST_DATABASE_URL ?= $(shell test -f secrets/postgres_password && printf 'postgresql+psycopg://messenger:%s@localhost:5432/messenger_test' "$$(cat secrets/postgres_password)")
TEST_DATABASE_URL ?= postgresql+asyncpg://$(DB_USER):$(DB_PASSWORD)@localhost:5432/$(DB_NAME)_test
export TEST_DATABASE_URL
.PHONY: help check validate test load test-persistence \
secrets up down logs db-up migrate migration \
up down logs db-up migrate migration \
test-own test-limits test-concurrency test-migrations
help:
@echo "Курс: check | validate | test (smoke по BASE_URL) | load | test-persistence ACTION_SCRIPT=scripts/restart.sh"
@echo "Стенд: secrets | up | down | logs | db-up (только PostgreSQL + тестовая БД) | migrate"
@echo "Стенд: up | down | logs | db-up (только PostgreSQL + тестовая БД) | migrate"
@echo "Свои: test-own | test-limits | test-concurrency | test-migrations | migration m='описание'"
check:
@@ -32,10 +34,6 @@ test-persistence:
@test -n "$(ACTION_SCRIPT)" || (echo "Set ACTION_SCRIPT to your implemented executable restart hook"; exit 2)
$(PYTHON) tests/resilience.py --mode persistence --action-script "$(ACTION_SCRIPT)" --base-url "$(BASE_URL)" $(TLS_ARGS)
secrets:
@mkdir -p secrets
@test -f secrets/postgres_password || (head -c 32 /dev/urandom | od -An -tx1 | tr -d ' \n' > secrets/postgres_password && chmod 644 secrets/postgres_password && echo "создан secrets/postgres_password")
up:
docker compose --env-file .env up -d --build
@@ -47,7 +45,7 @@ logs:
db-up:
docker compose up -d --wait postgres
docker compose exec -T postgres sh -c 'createdb -U "$$POSTGRES_USER" messenger_test 2>&1 | grep -v "already exists"; true'
docker compose exec -T postgres sh -c 'createdb -U "$$POSTGRES_USER" "$$POSTGRES_DB"_test 2>&1 | grep -v "already exists"; true'
migrate:
docker compose run --rm migrate