[object Object]

← back to Stars of Design

smoke: cover /healthz + HEAD method + harness opts.method

ea921b652ad9b0db6c0f9b10547f1a386ea75a69 · 2026-05-13 11:18:42 -0700 · Steve Abrams

Files touched

Diff

commit ea921b652ad9b0db6c0f9b10547f1a386ea75a69
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Wed May 13 11:18:42 2026 -0700

    smoke: cover /healthz + HEAD method + harness opts.method
---
 test/smoke.js | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/test/smoke.js b/test/smoke.js
index 1dfb204..100d942 100644
--- a/test/smoke.js
+++ b/test/smoke.js
@@ -17,14 +17,16 @@ const TIMEOUT_MS = 8_000;
 function fetch(path, opts = {}) {
   const u = new URL(path, BASE);
   const lib = u.protocol === 'https:' ? https : http;
+  const method = opts.method || 'GET';
   return new Promise((resolve, reject) => {
-    const req = lib.get(u, { timeout: TIMEOUT_MS, headers: opts.headers || {} }, (res) => {
+    const req = lib.request(u, { method, timeout: TIMEOUT_MS, headers: opts.headers || {} }, (res) => {
       let body = '';
       res.on('data', (c) => (body += c));
       res.on('end', () => resolve({ status: res.statusCode, headers: res.headers, body }));
     });
     req.on('error', reject);
     req.on('timeout', () => { req.destroy(new Error('timeout')); });
+    req.end();
   });
 }
 
@@ -112,6 +114,15 @@ function check(name, cond, hint = '') {
   check('api: 200',                    r.status === 200);
   check('api: discovery doc',          /endpoints/.test(r.body) && /Stars of Design API/.test(r.body));
 
+  // 8a1. /healthz — k8s liveness alias (no DB, no-store)
+  r = await fetch('/healthz');
+  check('healthz: 200',                r.status === 200);
+  check('healthz: ok JSON',            /"ok":true/.test(r.body));
+  check('healthz: no-store',           (r.headers['cache-control'] || '').includes('no-store'));
+  // HEAD method support — monitoring tools often probe with HEAD
+  r = await fetch('/healthz', { method: 'HEAD' });
+  check('healthz: HEAD 200',           r.status === 200);
+
   // 8a2. /api/health — perf budget enforced (500ms ceiling)
   {
     const t0 = Date.now();

← 4817b26 smoke: assert Last-Modified on /sitemap.{xml,txt}  ·  back to Stars of Design  ·  smoke: assert /api/{designers,firms,clients}/featured SWR Ca 03cea56 →