feat: add HAproxy and 2 api instances
This commit is contained in:
@@ -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 "")
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user