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:
parent
f4804d2150
commit
de100ee611
3 changed files with 246 additions and 10 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue