test(worker): add retry and persistence checks and adapt attachment tests for async processing

This commit is contained in:
kk10
2026-11-16 12:41:11 +03:00
parent 4a6176fe81
commit eafc437933
9 changed files with 345 additions and 70 deletions
+6 -3
View File
@@ -9,6 +9,7 @@ import (
"io"
"net/http"
"testing"
"time"
"github.com/google/uuid"
@@ -29,14 +30,16 @@ func TestAttachmentJPEG(t *testing.T) {
}
resp := uploadAttachment(t, user, chat.ID, "sample.jpg", "image/jpeg", body.Bytes())
requireStatus(t, resp, http.StatusCreated)
requireStatus(t, resp, http.StatusAccepted)
var att dto.AttachmentResponse
mustDecode(t, resp, &att)
if att.Status != "ready" {
t.Fatalf("expected ready attachment, got %q", att.Status)
if att.Status != "queued" {
t.Fatalf("expected queued attachment, got %q", att.Status)
}
waitAttachment(t, user, att.ID, "ready", time.Minute)
resp = doRequest(t, http.MethodGet, "/api/v1/attachments/"+att.ID.String()+"/content", user.Token, nil)
requireStatus(t, resp, http.StatusOK)
defer resp.Body.Close()