gitoria

ident

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit953bf03a953bf03a|||PR ident setF mirror dropped (hybriel#370)mre953bf03a/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

  • 953bf03a|||PR ident setF mirror dropped (hybriel#370)mre
  • a1419d9cMerge branch 'f15-navigate' into mainIdent
  • 3b3e451f|||PR ident#36 navigate to the app instead of location.assignmre
  • e36f4516Merge branch 'f14-online' into mainIdent
  • 2c5eac91|||PR ident#38 online state without probe timermre
  • bf1980f2Merge branch 'v56-day56' into mainIdent
  • 62ae0adf|||PR ident: vendor Hybriel day56mre
  • 0d18abc4Merge branch 'f13-avatar' into mainIdent
  • 2a99730a|||PR ident#37 avatar in hlmre
  • fa4ed25bMerge branch 'f11-upsert' into mainIdent
  • 8f3d9bc9|||PR ident#42 keyed upsert and removemre
  • 675493b1ident#42: editing an identity upserts the one edited row (face editIdentity answers { identity, row }); a create or delete keeps the whole list because the rows' position-dependent parts (default, Delete, Identity n) changemre
  • 45e55303ident#42: an app write patches one row: upsert on create, edit and new secret, one-argument remove on delete; the faces answer the changed app (or the deleted id), not the whole listmre
  • 991641d4Merge branch 'f10-access' into mainIdent
  • e56d8273|||PR ident#34 part 4: access and inbox fixed classesmre
  • df7696dbident#34: tests: access ticks selector quoting fixmre
  • 7215903eident#34: access: the unstyled classes all, app, tick, apptick, plus are dropped; the gate finds the app ticks by input[name=app]mre
  • 69b0a0ceident#34: access: the pick buttons use Style.pickCard instead of class pickmre
  • dc702419Merge branch 'f9-choose' into mainIdent
  • 8caec771|||PR ident#34 restore .choose hookmre