From 95b1c93340350f9f90c6af613bc907b7316fa351 Mon Sep 17 00:00:00 2001 From: slayerjain Date: Tue, 23 Jun 2026 15:31:09 +0530 Subject: [PATCH] fix(sqs-samples): add /healthz so replay can gate on app readiness MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The sqs-localstack e2e step replays with a fixed --delay; under CI resource pressure the app + its mongo/localstack deps can take longer than that to start, so replayed requests hit a not-yet-serving app and fail with "status_code got=0" (a flaky enterprise CI step). The app exposed no 2xx GET endpoint to poll — only GET /:param (redirect/404) and POST /url. Add a static GET /healthz returning 200; gin prioritises it over the "/:param" wildcard. The replay driver can now gate on real readiness (keploy --health-url) instead of a fixed delay. Recording is unaffected (the route is never exercised during record). Signed-off-by: slayerjain --- sqs-samples/main.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sqs-samples/main.go b/sqs-samples/main.go index c675191d..fbdb2879 100644 --- a/sqs-samples/main.go +++ b/sqs-samples/main.go @@ -82,6 +82,15 @@ func main() { r := gin.Default() + // Liveness/readiness endpoint. Static routes take precedence over the + // "/:param" wildcard in gin, so this is not shadowed by getURL. Lets the + // replay driver gate on real app readiness (keploy --health-url) instead of + // a fixed --delay, which under CI contention fired requests before the app + // was serving and produced spurious "status_code got=0" failures. + r.GET("/healthz", func(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{"status": "ok"}) + }) + r.GET("/:param", getURL) r.POST("/url", putURL) srv := &http.Server{