Files
AetherForge/agent/client/pathtracer_windows_test.go
AetherForge 7b2d41cda8
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Expand P2 test coverage: mining chain, spread lanes, path forge, WS/beacon, E2E onion, file handling
2026-06-07 04:58:55 -07:00

67 lines
1.5 KiB
Go

//go:build windows
package client
import (
"strings"
"testing"
)
func TestPathTracerWindowsBuildWGConfigDefaults(t *testing.T) {
conf := buildWGConfig("privkeyB64=", WGConfigPayload{
LocalAddress: "10.66.0.2/24",
ListenPort: 0,
Peers: []WGPeerEntry{{
PublicKey: "peerPub=",
Endpoint: "203.0.113.5:51820",
}},
})
for _, want := range []string{
"[Interface]",
"PrivateKey = privkeyB64=",
"Address = 10.66.0.2/24",
"ListenPort = 51820",
"[Peer]",
"PublicKey = peerPub=",
"Endpoint = 203.0.113.5:51820",
"AllowedIPs = 0.0.0.0/0",
"PersistentKeepalive = 25",
} {
if !strings.Contains(conf, want) {
t.Errorf("config missing %q:\n%s", want, conf)
}
}
}
func TestPathTracerWindowsGenerateWGKeyPairDistinct(t *testing.T) {
priv1, pub1, err := generateWGKeyPair()
if err != nil {
t.Fatalf("generateWGKeyPair: %v", err)
}
priv2, pub2, err := generateWGKeyPair()
if err != nil {
t.Fatalf("generateWGKeyPair second call: %v", err)
}
if priv1 == "" || pub1 == "" {
t.Fatal("expected non-empty keypair")
}
if priv1 == priv2 || pub1 == pub2 {
t.Fatal("expected distinct keypairs across calls")
}
}
func TestPathTracerWindowsWGIsActiveFalseWhenIdle(t *testing.T) {
WGTeardown()
if WGIsActive() {
t.Fatal("WGIsActive should be false with no tunnel")
}
}
func TestPathTracerWindowsWGStatusNoTunnelWhenIdle(t *testing.T) {
WGTeardown()
status := WGStatus()
if !strings.Contains(status, "no active tunnel") {
t.Errorf("expected idle status, got %q", status)
}
}