tests: add signature verification tests for narinfo, mesh, and config

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I06ef2f37f174d278ce4f727836f339dd6a6a6964
This commit is contained in:
raf 2026-03-06 18:34:04 +03:00
commit de100ee611
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
3 changed files with 246 additions and 10 deletions

View file

@ -149,6 +149,27 @@ func TestValidateMeshEnabledNoPeers(t *testing.T) {
}
}
func TestValidateMeshBadPeerKey(t *testing.T) {
cfg, _ := config.Load("")
cfg.Mesh.Enabled = true
cfg.Mesh.Peers = []config.PeerConfig{
{Addr: "127.0.0.1:7946", PublicKey: "not-hex!"},
}
if err := cfg.Validate(); err == nil {
t.Error("expected error for invalid mesh peer public key")
}
}
func TestValidateUpstreamBadPublicKey(t *testing.T) {
cfg, _ := config.Load("")
cfg.Upstreams = []config.UpstreamConfig{
{URL: "https://cache.nixos.org", PublicKey: "no-colon-here"},
}
if err := cfg.Validate(); err == nil {
t.Error("expected error for upstream public_key missing ':'")
}
}
func TestInvalidDuration(t *testing.T) {
yamlContent := `
server: