Files
urutau/internal/app/probefiles_test.go
T
Lucas RayanandClaude Opus 5.5 19afd221e2
CI / Format and vet (push) Successful in 1m4s
CI / Dependency audit (push) Successful in 33s
CI / Tests (Linux, race detector) (push) Successful in 2m10s
Release / Plan (reuse the published image?) (push) Successful in 5s
Release / ci (push) Skipped
Release / Build hub image (amd64) (push) Skipped
Release / Build probe image (amd64) (push) Skipped
Release / Build hub image (arm64) (push) Skipped
Release / Build probe image (arm64) (push) Skipped
Release / Publish tags (hub) (push) Successful in 16s
Release / Publish tags (probe) (push) Successful in 16s
Release / Gitea release (push) Successful in 5s
fix: keep probe files across hub restarts; phone filter sheet above the tab bar (2.1.2)
The hub kept a probe's resolv.conf and containers.map only in memory, so
after a restart the egress lines replayed on reconnect were judged with
the hub's own resolvers (false dns_bypass, hostinger/INC-8). They are now
saved in the node directory and loaded at start.

Phone: the global filter sheet opens above the bottom tab bar, the tab
bar closes it, and the sticky filter bar no longer covers the More menu.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 08:41:28 -03:00

30 lines
1.0 KiB
Go

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)
}
}