Добавить 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
+7
View File
@@ -50,6 +50,9 @@ func TestMain(m *testing.M) {
const testPassword = "correct-horse-battery"
// testInstance is the alias of the in-process application under test.
const testInstance = "00000000000000a1"
// errorBody mirrors the contract error envelope.
type errorBody struct {
Error struct {
@@ -103,6 +106,7 @@ func newTesterWithTTL(t *testing.T, ttl time.Duration) *tester {
Sessions: kv.Client,
SessionTTL: ttl,
MaxBodyBytes: 64 * 1024,
InstanceID: testInstance,
})}
}
@@ -135,6 +139,9 @@ func (ts *tester) do(method, path, token string, body any, headers map[string]st
if res.requestID == "" {
ts.t.Fatalf("%s %s: missing X-Request-Id", method, path)
}
if got := rec.Header().Get("X-Instance-Id"); got != testInstance {
ts.t.Fatalf("%s %s: X-Instance-Id = %q, want %q", method, path, got, testInstance)
}
if res.status >= 400 {
var eb errorBody
if err := json.Unmarshal(res.raw, &eb); err != nil {