forked from mtusi2026/mtusi2026lab7
lab7: исправления по прогону своих тестов (таймаут Valkey с TLS 1,0 с, проверки по alias, GET вместо EXISTS), черновик REPORT, сборщик доказательств
This commit is contained in:
@@ -120,7 +120,8 @@ def test_secrets_are_not_stored_in_plain_text(api):
|
||||
hashed = "session:" + hashlib.sha256(actor["token"].encode()).hexdigest()
|
||||
script = ('read -r REDISCLI_AUTH; export REDISCLI_AUTH; read -r k1; read -r k2; '
|
||||
'c="valkey-cli --tls --cacert /run/secrets/internal-ca.crt -h localhost --user api --no-auth-warning"; '
|
||||
'$c exists "$k1"; $c exists "$k2"')
|
||||
# GET, not EXISTS: the ACL of `api` allows only the commands the API uses
|
||||
'for k in "$k1" "$k2"; do [ -n "$($c get "$k")" ] && echo 1 || echo 0; done')
|
||||
pw = (ROOT / "secrets" / "valkey_api_password").read_text(encoding="utf-8").strip()
|
||||
out = subprocess.run(["docker", "compose", "exec", "-T", "valkey", "sh", "-c", script], cwd=ROOT, capture_output=True,
|
||||
input=f"{pw}\n{hashed}\nsession:{actor['token']}\n".encode()).stdout.decode().split()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Dependency failures with a VALID session: bounded 503, never anonymous access, recovery afterwards.
|
||||
|
||||
Every test stops/pauses a real container and restores it in `finally` (service_down).
|
||||
Timing bounds: DB_TIMEOUT_SECONDS=3 (client deadline), CACHE_TIMEOUT_SECONDS=0.5.
|
||||
Timing bounds: DB_TIMEOUT_SECONDS=3 (client deadline), CACHE_TIMEOUT_SECONDS=1.0 (lab 7: incl. TLS handshake).
|
||||
|
||||
Lab 3: requests go through HAProxy. While the outage is being detected the replicas answer
|
||||
503 themselves; once every replica fails /health/ready, HAProxy answers 503 in the same
|
||||
@@ -20,7 +20,7 @@ from conftest import ROOT, probe_inside, restart_services, running_replicas, ser
|
||||
pytestmark = pytest.mark.stack
|
||||
|
||||
DB_BOUND = 3.6 # DB_TIMEOUT_SECONDS + network/HTTP overhead
|
||||
CACHE_BOUND = 1.6 # 2 x CACHE_TIMEOUT_SECONDS + overhead
|
||||
CACHE_BOUND = 2.6 # 2 x CACHE_TIMEOUT_SECONDS + overhead
|
||||
|
||||
|
||||
def timed(api, *args, **kwargs):
|
||||
|
||||
@@ -64,7 +64,7 @@ def test_upload_survives_failover_of_the_serving_replica(api, pair):
|
||||
data = imagegen.png_of_size(500_000)
|
||||
response = api.upload(alice, chat, data)
|
||||
att, served_by = response.json(), response.headers["x-instance-id"]
|
||||
replica = next(r for r in running_replicas() if r["hostname"] == served_by)
|
||||
replica = next(r for r in running_replicas() if r["instance"] == served_by)
|
||||
api.wait_status(bob, att["id"], "ready")
|
||||
with replica_stopped(replica, "kill"):
|
||||
for _ in range(5):
|
||||
|
||||
Reference in New Issue
Block a user