From c433e5a52fee2b86654588ab71a03e4b228c804d Mon Sep 17 00:00:00 2001 From: simoleo89 Date: Thu, 30 Jul 2026 18:41:26 +0200 Subject: [PATCH] fix(deploy): clear EADDRINUSE orphans and update deploy contract tests Co-authored-by: Cursor --- src/lib/deploy-workflow-contract.test.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/lib/deploy-workflow-contract.test.ts b/src/lib/deploy-workflow-contract.test.ts index 1a561267..45545357 100644 --- a/src/lib/deploy-workflow-contract.test.ts +++ b/src/lib/deploy-workflow-contract.test.ts @@ -68,7 +68,10 @@ describe("production deploy workflow", () => { const stopAt = deployJob.indexOf("pm2 stop next"); const migrateAt = deployJob.indexOf("pnpm db:migrate"); const startLabelAt = deployJob.indexOf("Starting PM2"); - const startAt = deployJob.indexOf("pm2 reload next", startLabelAt); + const startAt = deployJob.indexOf( + "pm2 start pnpm --name next -- start", + startLabelAt, + ); expect(buildAt).toBeGreaterThan(-1); expect(stopAt).toBeGreaterThan(buildAt); expect(migrateAt).toBeGreaterThan(stopAt); @@ -103,7 +106,9 @@ describe("production deploy workflow", () => { it("runs an HTTP health check before declaring deploy success", () => { expect(workflow).toContain("/api/health"); expect(workflow).toContain('"database":true'); - const startAt = deployJob.indexOf("pm2 reload next"); + expect(deployJob).toContain("export PORT="); + expect(deployJob).toContain("free_tcp_port"); + const startAt = deployJob.indexOf("pm2 start pnpm --name next -- start"); const healthAt = deployJob.indexOf("/api/health"); const successAt = deployJob.indexOf("--- Deployed successfully ---"); expect(startAt).toBeGreaterThan(-1);