gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit096ce0d4096ce0d4log: DP69 live on day48mre096ce0d4/plugins/fetch/tests/refused-catch.mjs

1.3 KB

  1. // refused-catch.mjs — mission 517 (hybriel#240). A fetch to a closed port, an unknown host
  2. // and a closed https port must each give an error `on Error` can catch, with the host:port and
  3. // the reason in the message, and the program must run on to its end.
  4. import { spawnSync } from 'node:child_process';
  5. import net from 'node:net';
  6. import path from 'node:path';
  7. import { fileURLToPath } from 'node:url';
  8. const HERE = path.dirname(fileURLToPath(import.meta.url));
  9. const ROOT = path.resolve(HERE, '../../..');
  10. const BIN = process.env.HL_BIN || path.resolve(ROOT, 'native/zig-out/bin/hybriel');
  11. // Find a port nothing listens on: bind one, note it, close it.
  12. const probe = net.createServer();
  13. await new Promise((r) => probe.listen(0, '127.0.0.1', r));
  14. const port = probe.address().port;
  15. await new Promise((r) => probe.close(r));
  16. const r = spawnSync(BIN, [path.join(HERE, 'refused_catch.hl')], {
  17. env: { ...process.env, HL_TEST_PORT: String(port) }, encoding: 'utf8', timeout: 60000,
  18. });
  19. const log = (r.stdout || '') + (r.stderr || '');
  20. const ok = r.status === 0
  21. && log.includes(`127.0.0.1:${port}/x: connection refused`)
  22. && log.includes('could not resolve host')
  23. && log.includes('done 3 true true true');
  24. if (ok) { console.log('PASS refused, https refused and unknown host are caught'); process.exit(0); }
  25. console.log(`FAIL exit ${r.status}\n` + log.slice(-1500));
  26. process.exit(1);

Branches

Latest commits

  • 096ce0d4log: DP69 live on day48mre
  • b3d8a80bDP69 brief, RV48 mergedmre
  • ce6d7d32Merge rv48: Hybriel day48mre
  • 3da2ea86RV48: report day48 cold starts, gates and cleanupmre
  • 8d9ecdfeRV48: re-vendor Hybriel set day48 (source b6a8f429, bin 660a9524)mre
  • 4a802ae7status: RV48 runningmre
  • 0a5412b6RV48 brief, day48 outmre
  • 56665efelog: CB69 mergedmre
  • 05448a98Merge cb69-imports: appTitle in a dependency-free topicmre
  • e55b379dKeep shared app title independent of the route import graphmre
  • 9a99659blog: hybriel#334, batch waits for day48mre
  • 85fa6c9blog: CB68 result, CB69 startedmre
  • 2f07c1b7log: DP68 boot gate failed, CB68mre
  • 9652782dlog: HM59 merged, DP68 startedmre
  • 29867a75Merge hm59-logic: tracker#59 page logic moved to libmre
  • f7bfe90bMove remaining page builders into their topicsmre
  • 7c3991f9log: day46 from Antonmre
  • ec54fc35Move show page logic into the shows topicmre
  • c1a8d074log: correct timesmre
  • 5827eba9log: HM57 merged, HM59 startedmre