gitoria

gitoria

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit2ed094412ed09441Use layouts theme 17e0f03 for W61 compatibilitymre2ed09441/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

  • 2ed09441Use layouts theme 17e0f03 for W61 compatibilitymre
  • b8609a91Merge branch 'main' into w61-stylemre
  • 4639caf7Report W61 theme startup blocker and day39 Style probemre
  • 81f0a0bbREADME: two caches were restored by 90b4f72; log W62mre
  • 4a3f557eImport layouts theme ebd00b6 for W61 (startup blocked)mre
  • ab12a257Merge W62: #25 commit page measurements and proc repromre
  • 41323e49gitoria#25: measure commit request costs and reproduce blocking process waitsmre
  • 53ca42b2log: W60 merged, W61 W62 startedmre
  • 80870a33mission W61: style passmre
  • 560fd208Merge W60: helpers, bound forms, login in topics, two form fixes (gitoria#28 #32 #33)mre
  • ac5ba6a4log: W60, #25 measuredmre
  • 220f6342W60: record corrected form proof, full AE and remaining gapsmre
  • 7e31cac5gitoria#28: restrict reply form layout to reply formsmre
  • ae373cfdgitoria#28: keep each reply draft in its thread componentmre
  • eeeebd5agitoria: insert a newly created organization oncemre
  • 34d2d5cagitoria: clear the bound public-key textarea after creationmre
  • 119e54c0W60: restore conductor-owned tracking filesmre
  • 24b479e7W60: record final gates, Chrome failures and AE evidencemre
  • 5e11184cW60: record partial validation, framework gaps and cleanupmre
  • 20fe13fagitoria#33: centralize login and tickets connection statemre