From 463626d473354b434a42f080477485ec4ccc9f9d Mon Sep 17 00:00:00 2001 From: sneak Date: Fri, 2 Oct 2026 15:24:29 +0000 Subject: [PATCH] Assert the body a retry delivers, not only its status (closes #294) TestProcessRetryTask_LargeBody_FetchFromDB and TestProcessRetryTask_SuccessfulRetry checked only that the delivery ended delivered, so a retry that sent an empty or wrong body still passed. Both now compare the body received at the sink with the stored event body, as the processNewTask large-body test already does. Model: opus-5-5 --- internal/delivery/engine_integration_test.go | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/internal/delivery/engine_integration_test.go b/internal/delivery/engine_integration_test.go index 90d028e..784cf2a 100644 --- a/internal/delivery/engine_integration_test.go +++ b/internal/delivery/engine_integration_test.go @@ -355,9 +355,14 @@ func TestProcessRetryTask_SuccessfulRetry(t *testing.T) { s := newISetup(t) + var receivedBody string + ts := httptest.NewServer( http.HandlerFunc( - func(w http.ResponseWriter, _ *http.Request) { + func(w http.ResponseWriter, r *http.Request) { + body, _ := io.ReadAll(r.Body) + receivedBody = string(body) + w.WriteHeader(http.StatusOK) }, ), @@ -397,6 +402,8 @@ func TestProcessRetryTask_SuccessfulRetry(t *testing.T) { context.TODO(), &task, ) + assert.Equal(t, event.Body, receivedBody) + iAssertStatus(t, s.WebhookDB, d.ID, database.DeliveryStatusDelivered, ) @@ -443,9 +450,14 @@ func TestProcessRetryTask_LargeBody_FetchFromDB( s := newISetup(t) + var receivedBody string + ts := httptest.NewServer( http.HandlerFunc( - func(w http.ResponseWriter, _ *http.Request) { + func(w http.ResponseWriter, r *http.Request) { + body, _ := io.ReadAll(r.Body) + receivedBody = string(body) + w.WriteHeader(http.StatusOK) }, ), @@ -482,6 +494,8 @@ func TestProcessRetryTask_LargeBody_FetchFromDB( context.TODO(), &task, ) + assert.Equal(t, largeBody, receivedBody) + iAssertStatus(t, s.WebhookDB, d.ID, database.DeliveryStatusDelivered, )