package app import ( "io" "log/slog" "testing" "git.lucasrguerra.dev.br/ciberfauna/urutau/internal/wire" ) // The files sent by a probe survive a hub restart: without them the egress // lines the probe replays right after reconnecting were judged with the hub's // own resolvers (a dns_bypass false positive on the probe's upstream resolver). func TestProbeFilesSurviveRestart(t *testing.T) { dir := t.TempDir() sh := &shared{log: slog.New(slog.NewTextHandler(io.Discard, nil))} n := &Node{name: "hostinger", Dir: dir, sh: sh} n.saveProbeFile(wire.FileResolv, []byte("nameserver 153.92.2.6\n")) n.saveProbeFile(wire.FileContainers, []byte("172.17.0.2 coolify-sentinel\n")) n2 := &Node{name: "hostinger", Dir: dir, sh: sh} n2.loadProbeFiles() if b := n2.resolv.Load(); b == nil || string(*b) != "nameserver 153.92.2.6\n" { t.Fatalf("resolv.conf not restored: %v", b) } if b := n2.containers.Load(); b == nil || string(*b) != "172.17.0.2 coolify-sentinel\n" { t.Fatalf("containers.map not restored: %v", b) } }