[object Object]

← back to AsSeenInMovies

smoke: cover /healthz (200, ok JSON, no-store, HEAD method) + harness opts.method

888e73e733eaf12f294e20115229ccfb85d5fad2 · 2026-05-13 11:18:36 -0700 · SteveStudio2

Files touched

Diff

commit 888e73e733eaf12f294e20115229ccfb85d5fad2
Author: SteveStudio2 <stevestudio2@SteveStacStudio.lan>
Date:   Wed May 13 11:18:36 2026 -0700

    smoke: cover /healthz (200, ok JSON, no-store, 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 ebf45ab..3070372 100644
--- a/test/smoke.js
+++ b/test/smoke.js
@@ -20,14 +20,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();
   });
 }
 
@@ -116,6 +118,15 @@ function check(name, cond, hint = '') {
   check('api: 200',            r.status === 200);
   check('api: discovery doc',  /endpoints/.test(r.body) && /AsSeenInMovies API/.test(r.body));
 
+  // 10a2. /healthz — k8s liveness alias (no DB, no cache, 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);
+
   // 10b. /api/health — perf budget enforced (500ms generous ceiling that catches
   // accidental N+1 queries / pool exhaustion sneaking back in)
   {

← 32e313c sitemap.xml: preserve Last-Modified+Cache-Control on cache-h  ·  back to AsSeenInMovies  ·  sitemap: extract buildSitemapXml() helper — coalesce concurr 8243fbe →