gitoria

tickets

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit772e0696772e0696|||PR Allow project admins to move tickets between their projectsmre772e0696/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

  • 772e0696|||PR Allow project admins to move tickets between their projectsmre
  • be92a560Merge branch 'records' into mainTickets
  • 0daf2ea8|||PR records: PR-only workflow, #50 donemre
  • 0185d0b6Log PR 1 deploymre
  • f5bf16e2Mission 031: deploy PR 1mre
  • c69cd5f3Merge branch 'pr-flow' into mainTickets
  • cc56798cLog gitoria PR-only requestmre
  • d876d0b2|||PR README: changes land as PRsmre
  • fd83ac1fconductor: caramboleyo is the user, not owner/creatorApollo
  • 3b858c91Log backup hard-link fixmre
  • 7f6b37a0deploy.sh backup: tar --hard-dereference (hard links broke mpackdb sidecars on restore)mre
  • e93711d9Log E30 livemre
  • 59c02e4dMerge e30: preserve edited state note labels in Markdownmre
  • 30970796Log E30 deploy GOmre
  • 7c8e6d83Limit edited state note fix to Markdown renderingmre
  • 910536d0Log E30 reviewmre
  • 36984386Preserve state transitions when their notes are editedmre
  • d75cb946Log E30 startmre
  • 0bf3fefaMission 030: edited state note labelmre
  • 691565c6Log neutral-ticket rule checkmre