Добавить X-Instance-Id, задержку drain при SIGTERM и отдельный запуск миграций

This commit is contained in:
2026-11-02 16:58:11 +03:00
parent 5b9f377783
commit 7fa8881eb3
21 changed files with 389 additions and 64 deletions
+5 -2
View File
@@ -146,11 +146,14 @@ func TestLogoutRevokesOnlyTheCurrentToken(t *testing.T) {
ts.expect(ts.do(http.MethodGet, "/api/v1/users/me", other.Token, nil, nil), http.StatusOK, "")
}
// The TTL leaves room for a loaded machine: with one second the first request
// after login sometimes arrived too late under -race with all packages
// running at once.
func TestSessionExpiresAfterTTL(t *testing.T) {
ts := newTesterWithTTL(t, time.Second)
ts := newTesterWithTTL(t, 3*time.Second)
alice := ts.user("alice", "A")
ts.expect(ts.do(http.MethodGet, "/api/v1/users/me", alice.token, nil, nil), http.StatusOK, "")
time.Sleep(1200 * time.Millisecond)
time.Sleep(3200 * time.Millisecond)
ts.expect(ts.do(http.MethodGet, "/api/v1/users/me", alice.token, nil, nil), http.StatusUnauthorized, "unauthorized")
}