/** * The local management box must never be reported unreachable. * * celilo runs there as the `celilo` user and deliberately holds no SSH key for * itself, so probing `root@127.0.0.1` fails with `Permission denied (publickey)` * on a completely healthy host. That produced a permanently firing * `machines_reachable` alert against celilo-mgr — and that monitor is * unsuppressible by design, so nothing could explain it away. */ import { describe, expect, test } from 'bun:test'; import { auditMachinesReachable } from './audit/machines-reachable'; import { LOCAL_MACHINE_IP } from './ssh-key-manager'; describe('local machine reachability', () => { test('LOCAL_MACHINE_IP is the loopback address the machine pool records', () => { // The probe's skip is keyed on this exact value, so pin it. expect(LOCAL_MACHINE_IP).toBe('127.0.0.1'); }); test('a reachable local box produces no finding', async () => { const findings = await auditMachinesReachable({ results: [ { hostname: 'celilo-mgr', ipAddress: LOCAL_MACHINE_IP, reachable: true }, { hostname: 'briq', ipAddress: '192.168.0.254', reachable: true }, ], }); expect(findings).toEqual([]); }); test('an unreachable remote machine still produces a finding', async () => { // The skip must not blunt the check for the machines it exists to watch. const findings = await auditMachinesReachable({ results: [ { hostname: 'celilo-mgr', ipAddress: LOCAL_MACHINE_IP, reachable: true }, { hostname: 'briq', ipAddress: '192.168.0.254', reachable: false, message: 'connection refused', }, ], }); expect(findings).toHaveLength(1); expect(findings[0].message).toContain('briq'); }); });