test: sweep example data in test files to RFC-5737 + placeholders

Mirrors the .md/.txt sweep across all tracked _test.go, testdata XML,
and .http integration files. Test files are self-contained (producer
+ assertion in the same file), so the matched-pair swap stays green
under `go test ./...`.

Mapping applied:
  192.168.178.[0-9]+   → 192.0.2.[same]
  192.168.1.[0-9]+     → 192.0.2.[same]
  Sound Machinechen    → Living Room SoundTouch
  A Sound Machine      → Kitchen SoundTouch
  A81B6A536A98 + case/separator variants → AABBCCDDEEFF (etc.)
  A81B6A849D99         → AABBCCDDEE01
  A81B6A849D88         → AABBCCDDEE03
  A81B6A536A09         → AABBCCDDEE04
  884AEAEEBD27         → AABBCCDDEE02
  3230304              → 1000001
  9569497              → 1000002

Two semantic fixes alongside the bulk swap:

- pkg/service/zeroconf/zeroconf_test.go: the "private 192" and
  "strips query" cases pin acceptance of RFC-1918 192.168/16. They
  must use a real 192.168 value; doc-range IPs would (correctly) be
  rejected by validateZcBaseURL. Switched to 192.168.10.10 — generic
  enough not to match any home LAN default, real enough for the
  validator. Added a comment explaining why this single test still
  carries a 192.168 literal.

- pkg/service/setup/setup_test.go: TestTestDNSRedirection mocks the
  device's `od -An -tu1` byte output, which is space-separated
  octets ("192 168 1 100"). My sed only matched the dot-separated
  form, so the mock was returning the old IP while the test
  assertions had moved to the doc range. Updated to " 192 0 2 100".

go build ./... clean. go test ./... clean (only TestDocsConsistency
remains failing, which is a pre-existing/untracked-file issue).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Tobias Gesellchen
2026-05-17 22:05:13 +02:00
co-authored by Claude Opus 4.7
parent 249c2586e9
commit feadc478d5
81 changed files with 739 additions and 734 deletions
+1 -1
View File
@@ -34,7 +34,7 @@ func TestPathPatterns_Sanitize(t *testing.T) {
segment string
wantRepl string
}{
{"192.168.1.100", "{ip}"},
{"192.0.2.100", "{ip}"},
{"1234567", "{accountId}"},
{"12345", "{accountId}"},
{"12345678-1234-5678-9012-123456789012", "{uuid}"},
+6 -6
View File
@@ -52,7 +52,7 @@ func TestRecorder_Record_Structure(t *testing.T) {
{
name: "path_with_ip",
category: "self",
path: "/setup/info/192.168.1.100",
path: "/setup/info/192.0.2.100",
expected: "setup/info/{ip}",
},
{
@@ -131,11 +131,11 @@ func TestRecorder_Record_Sanitization(t *testing.T) {
req := &http.Request{
Method: "GET",
URL: &url.URL{
Path: "/info/192.168.1.100/A81B6A536A98",
Path: "/info/192.0.2.100/AABBCCDDEEFF",
},
Header: make(http.Header),
}
req.Header.Set("X-Device", "A81B6A536A98")
req.Header.Set("X-Device", "AABBCCDDEEFF")
err = r.Record("self", req, nil)
if err != nil {
@@ -331,7 +331,7 @@ func TestRecorder_EnvFile(t *testing.T) {
req := &http.Request{
Method: "GET",
URL: &url.URL{
Path: "/info/192.168.1.100",
Path: "/info/192.0.2.100",
},
Header: make(http.Header),
}
@@ -352,8 +352,8 @@ func TestRecorder_EnvFile(t *testing.T) {
t.Fatalf("Failed to unmarshal env file: %v", err)
}
if content["session"]["ip"] != "192.168.1.100" {
t.Errorf("Expected ip to be 192.168.1.100, got %s", content["session"]["ip"])
if content["session"]["ip"] != "192.0.2.100" {
t.Errorf("Expected ip to be 192.0.2.100, got %s", content["session"]["ip"])
}
}