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

This commit is contained in:
AetherForge
2026-06-07 04:58:55 -07:00
parent b2a7b1723f
commit 7b2d41cda8
118 changed files with 9938 additions and 223 deletions

View File

@@ -4,12 +4,13 @@ package client
import (
"encoding/json"
"strings"
"testing"
)
// TestWGSetupJSONReturnsError verifies that the non-Windows stub returns a
// JSON error payload indicating WireGuard is not available on this platform.
func TestWGSetupJSONReturnsError(t *testing.T) {
func TestPathTracerStubWGSetupJSONReturnsError(t *testing.T) {
raw := WGSetupJSON()
if raw == "" {
t.Fatal("WGSetupJSON returned empty string")
@@ -34,7 +35,7 @@ func TestWGSetupJSONReturnsError(t *testing.T) {
}
// TestWGConfigureNoOp verifies that WGConfigure is a no-op on non-Windows.
func TestWGConfigureNoOp(t *testing.T) {
func TestPathTracerStubWGConfigureNoOp(t *testing.T) {
payload := WGConfigPayload{
SessionID: "test-session",
PrivateKey: "privkey",
@@ -56,22 +57,45 @@ func TestWGConfigureNoOp(t *testing.T) {
}
// TestWGTeardownNoOp verifies WGTeardown does not panic or error on non-Windows.
func TestWGTeardownNoOp(t *testing.T) {
func TestPathTracerStubWGTeardownNoOp(t *testing.T) {
// Should complete without panic.
WGTeardown()
}
// TestWGIsActiveReturnsFalse ensures the stub correctly reports inactive.
func TestWGIsActiveReturnsFalse(t *testing.T) {
func TestPathTracerStubWGIsActiveReturnsFalse(t *testing.T) {
if WGIsActive() {
t.Error("WGIsActive stub must return false on non-Windows")
}
}
// TestWGStatusNotSupported verifies the stub reports an unsupported-platform message.
func TestWGStatusNotSupported(t *testing.T) {
func TestPathTracerStubWGStatusNotSupported(t *testing.T) {
status := WGStatus()
if status == "" {
t.Error("WGStatus stub must return a non-empty string")
}
if !strings.Contains(status, "not supported") {
t.Errorf("WGStatus stub should mention unsupported platform, got %q", status)
}
}
// TestWGSetupJSONExactStubError verifies the stub error string matches server expectations.
func TestPathTracerStubWGSetupJSONExactError(t *testing.T) {
raw := WGSetupJSON()
if !strings.Contains(raw, "Windows-only") {
t.Errorf("stub error should mention Windows-only, got %q", raw)
}
}
// TestWGConfigureRejectsEmptyPayloadOnStub is a no-op but documents stub behaviour.
func TestPathTracerStubWGConfigureAcceptsPayload(t *testing.T) {
err := WGConfigure(WGConfigPayload{
SessionID: "stub-session",
LocalAddress: "10.66.0.2/24",
ListenPort: 51820,
})
if err != nil {
t.Errorf("WGConfigure stub must be no-op, got %v", err)
}
}