MCPcopy Create free account
hub / github.com/PasarGuard/node / TestNewWireGuardConfigLatencyNested

Function TestNewWireGuardConfigLatencyNested

backend/wireguard/config_test.go:80–101  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

78}
79
80func TestNewWireGuardConfigLatencyNested(t *testing.T) {
81 configJSON := `{
82 "latency": {
83 "test_url": "https://example.com/generate_204",
84 "timeout_seconds": 9
85 }
86 }`
87
88 config, err := NewConfig(configJSON)
89 if err != nil {
90 t.Fatalf("NewConfig failed: %v", err)
91 }
92 if config.Latency == nil {
93 t.Fatal("expected latency config")
94 }
95 if config.Latency.TestURL != "https://example.com/generate_204" {
96 t.Errorf("expected latency.test_url to round-trip, got: %s", config.Latency.TestURL)
97 }
98 if config.Latency.TimeoutSeconds != 9 {
99 t.Errorf("expected latency.timeout_seconds 9, got: %d", config.Latency.TimeoutSeconds)
100 }
101}
102
103func TestNewWireGuardConfigInvalidJSON(t *testing.T) {
104 configJSON := `{invalid json}`

Callers

nothing calls this directly

Calls 1

NewConfigFunction · 0.70

Tested by

no test coverage detected