feat: add HAproxy and 2 api instances

This commit is contained in:
TAskMAster339
2026-10-10 13:20:58 +03:00
parent a856733fe9
commit 771951cad7
23 changed files with 742 additions and 213 deletions
+7 -3
View File
@@ -68,13 +68,15 @@ def main():
token,
)
path = "/api/v1/chats/" + chat["id"] + "/messages"
key = secrets.token_hex(16)
body = {"text": "Перенос из лабораторной 2"}
message = call(
"POST",
path,
201,
{"text": "Перенос из лабораторной 2"},
body,
token,
{"Idempotency-Key": secrets.token_hex(16)},
{"Idempotency-Key": key},
)
assert call("GET", path, token=bob_token)["items"] == [message]
call("GET", "/api/v1/users/me", 401)
@@ -84,11 +86,13 @@ def main():
subprocess.run(["make", "app-up"], cwd=root, check=True)
assert call("GET", "/api/v1/users/me", token=token) == alice
assert call("GET", path, token=bob_token)["items"] == [message]
assert call("POST", path, 201, body, token, {"Idempotency-Key": key}) == message
assert call("GET", path, token=bob_token)["items"] == [message]
call("DELETE", "/api/v1/auth/sessions/current", 204, token=token)
call("GET", "/api/v1/users/me", 401, token=token)
print(
"PASS: transferred API, shared sessions, chat, message, logout"
+ (", persistence across app-down/app-up" if args.restart else "")
+ (", persistence and idempotent replay across app-down/app-up" if args.restart else "")
)