From 20c4ae5567211dc4541bb74a1e936fa4feb9bc45 Mon Sep 17 00:00:00 2001 From: Lemon-miaow Date: Tue, 29 Sep 2026 02:28:50 +0800 Subject: [PATCH] =?UTF-8?q?test(exports):=20=E7=AD=89=E5=BE=85=E6=B5=8F?= =?UTF-8?q?=E8=A7=88=E5=99=A8=E7=9A=84=E5=AF=BC=E5=87=BA=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E5=9C=A8=E5=AD=90=E6=B5=8B=E8=AF=95=E5=86=85=E5=8F=96=E8=B5=B0?= =?UTF-8?q?=E5=B9=B6=E7=AD=89=E5=AE=83=E8=BF=94=E5=9B=9E=EF=BC=8C-race=20?= =?UTF-8?q?=E4=B8=8B=E4=B8=8D=E5=86=8D=E5=92=8C=E4=B8=8B=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E5=AD=90=E6=B5=8B=E8=AF=95=E6=94=B9=E9=A2=86=E5=8F=96=E6=97=B6?= =?UTF-8?q?=E9=99=90=E6=92=9E=E8=BD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/api/exports_test.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/internal/api/exports_test.go b/internal/api/exports_test.go index de716a0..5e38a52 100644 --- a/internal/api/exports_test.go +++ b/internal/api/exports_test.go @@ -592,7 +592,7 @@ func TestExportExpiry(t *testing.T) { stuck := ex.reqs[0] v := beginExport(t, ext, "/api/v1/servers/creative/backups/bk2/export", "admin1") moving := ex.reqs[1] - uploadExport(a.InternalHandler(), moving.ID, moving.Token, strings.NewReader("archive"), contentDigestOf("archive")) + up := uploadExport(a.InternalHandler(), moving.ID, moving.Token, strings.NewReader("archive"), contentDigestOf("archive")) waitExportReady(t, ext, v.Ticket, "admin1") clock.Add(int64(exportPendingTTL/time.Second) - 1) @@ -612,6 +612,14 @@ func TestExportExpiry(t *testing.T) { t.Fatalf("also stopped %s, whose upload was waiting for its browser", job) case <-time.After(50 * time.Millisecond): } + // Its browser takes it, so the upload's handler has returned before the + // next subtest changes the claim TTL that handler reads. + if w := do(ext, "GET", "/api/v1/exports/"+v.Ticket+"/download", "", as("admin1")); w.Code != http.StatusOK || w.Body.String() != "archive" { + t.Fatalf("download of the waiting export = %d %q", w.Code, w.Body.String()) + } + if w := awaitUpload(t, up); w.Code != http.StatusNoContent { + t.Fatalf("upload answered %d %s, want 204", w.Code, w.Body.String()) + } }) t.Run("a browser that never comes", func(t *testing.T) {