gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commitf5a06a0ff5a06a0fLog: gitoria push setup, SR1Trackerf5a06a0f/plugins/fetch/tests/reset-peer.mjs

2.2 KB

  1. // reset-peer.mjs — mission 512. A TLS server that finishes the handshake and then
  2. // resets the connection must not kill the Hybriel program with SIGPIPE (exit 141,
  3. // which took the live tracker down every few minutes). The program has to see an
  4. // ordinary fetch error, catch it with `on Error`, and run to its end (exit 0).
  5. // Below what an .hl fixture can reach: it needs a raw TLS peer that resets.
  6. import { spawn, execFileSync } from 'node:child_process';
  7. import tls from 'node:tls';
  8. import fs from 'node:fs';
  9. import os from 'node:os';
  10. import path from 'node:path';
  11. import { fileURLToPath } from 'node:url';
  12. const HERE = path.dirname(fileURLToPath(import.meta.url));
  13. const ROOT = path.resolve(HERE, '../../..');
  14. const BIN = process.env.HL_BIN || path.resolve(ROOT, 'native/zig-out/bin/hybriel');
  15. const PORT = Number(process.env.HL_TEST_PORT || 14979);
  16. const dir = fs.mkdtempSync(path.join(process.env.TMPDIR || os.tmpdir(), 'reset-peer-'));
  17. const key = path.join(dir, 'k.pem'), cert = path.join(dir, 'c.pem');
  18. execFileSync('openssl', ['req', '-x509', '-newkey', 'rsa:2048', '-nodes', '-keyout', key, '-out', cert,
  19. '-days', '2', '-subj', '/CN=localhost', '-addext', 'subjectAltName=DNS:localhost,IP:127.0.0.1'], { stdio: 'ignore' });
  20. const server = tls.createServer({ key: fs.readFileSync(key), cert: fs.readFileSync(cert) }, (s) => {
  21. s.on('error', () => {});
  22. if (s.socket && s.socket.resetAndDestroy) s.socket.resetAndDestroy(); else s.destroy();
  23. });
  24. await new Promise((r) => server.listen(PORT, '127.0.0.1', r));
  25. const child = spawn(BIN, [path.join(HERE, 'reset_peer.hl')], {
  26. env: { ...process.env, HL_TEST_PORT: String(PORT), HL_TEST_CA: cert },
  27. stdio: ['ignore', 'pipe', 'pipe'],
  28. });
  29. let log = '';
  30. child.stdout.on('data', (d) => { log += d; });
  31. child.stderr.on('data', (d) => { log += d; });
  32. const timer = setTimeout(() => child.kill('SIGKILL'), 100000);
  33. const [code, sig] = await new Promise((r) => child.on('exit', (c, s) => r([c, s])));
  34. clearTimeout(timer);
  35. server.close();
  36. fs.rmSync(dir, { recursive: true, force: true });
  37. if (code === 0 && log.includes('survived 150')) { console.log('PASS survived 150 resets'); process.exit(0); }
  38. console.log(`FAIL exit code ${code} signal ${sig} (141 = SIGPIPE killed it)\n` + log.slice(-1500));
  39. process.exit(1);

Branches

Latest commits

  • f5a06a0fLog: gitoria push setup, SR1Tracker
  • d6b109baMission SR1mre
  • 608b7558Log: FF1 merged via PR #1mre
  • 2939d94cMerge branch 'ff1-gate-failfast' into mainTracker
  • c934361a|||PR tests: gates fail fast when the app exits during startmre
  • d714ae42Log/status: AP56 closed out, FF1mre
  • a429d088Mission FF1mre
  • 03bbfba3Log: AP56c causemre
  • 24845fe3Log: AP56b result, AP56cmre
  • 6a6d71eaLog: gitoria membershipmre
  • 8b842dc8Log + CONDUCTOR: gitoria PR switch-onmre
  • 6bb7c20estatus: window 2026-11-09mre
  • 5db84974Log: Apollo window GO, AP56b started, BS1 copy removedmre
  • e84586a7Mission AP56bmre
  • 15917f03Record PR workflow rule (gitoria#50)mre
  • 942ac995status: paused workers statemre
  • 44b934e5log: respawn cleanupmre
  • 03a80097Log: Anton GC A/Bmre
  • c7cdef62Log: Apollo STOP, workers pausedmre
  • d0c083fbLog: usage stopmre