Skip to content

Replace real-looking printer fixtures with fake test data - #3

Merged
FoxesRCool1 merged 1 commit into
mainfrom
grok/fake-test-data
Dec 5, 2026
Merged

FoxesRCool1 merged 1 commit into
mainfrom
grok/fake-test-data

Conversation

@FoxesRCool1

Copy link
Copy Markdown
Owner

Why

Public test files in this repo used real-looking printer names, Bambu serials, LAN IPs, and access codes. Those values do not belong in a public GitHub repository. This change replaces them with clearly fake fixtures so they cannot be mistaken for live devices.

This does not change runtime behavior. Only *_test.go files and one golden file are touched.

What was replaced

Consistent mapping across every test and testdata file:

  • Names: Monsieur, Sherlock, Watson, and Madame (plus case variants, id-monsieur / id-sherlock, "Monsieur Renamed", and "Madame-cloud-plug-test") became Test Printer A, B, C, and D (with the same suffixes and case patterns). Other fixture names (Hercule, Cloudy, Voron, P1S Shelf, and so on) were left alone.
  • Serials: the four real-looking 15-character 01P00C58… / 01P00C59… serials became 01P00TEST0000A1, 01P00TEST0000B2, 01P00TEST0000C3, and 01P00TEST0000E5. They keep the 01P prefix and length so bambuSerialModel still reports P1S. Already-fake serials such as 01P00A000000001 and 01P00CLOUDPLUG were left alone. A lowercase same-serial check was updated to 01p00test0000a1.
  • IPs: 192.168.87.22/24/26/30 became 192.0.2.22/24/26/30. Three fixture IPs that sat on the same printers (192.168.1.5 in the MQTT export test, 192.168.1.6 and 192.168.1.7 in the queue test) became 192.0.2.5/6/7. Generic example IPs in docs, UI placeholders, and unrelated tests were not changed.
  • Access codes: the three 8-character hexadecimal LAN codes tied to those printers (including leak-detection lists, "want" assertions, and log strings) became 12345678, 23456789, and 34567890. Already-dummy values such as 12345678 on other fixtures, SECRET-lan-1, newcode1, and one-character stubs were left alone.

A share-status leak check that looked for 192.168 now looks for 192.0.2, so it still tests the fixture IP. A regression test request path was written as /api/printers/Test%20Printer%20A because a raw space breaks the test request; the handler still sees "Test Printer A".

Golden file

mqttexport/mqttexport_test.go defines -update as a test flag (flag.Bool("update", …)). go test -update ./mqttexport/ does not work, because go test treats -update as its own flag and then has no package path. The golden was regenerated with:

CGO_ENABLED=0 go test -tags headless ./mqttexport/ -args -update

It was not edited by hand. The only change in mqttexport/testdata/discovery_bambu.golden.json is the printer name (13 places). The old serial was not in the golden.

Tested

  • CGO_ENABLED=0 go test -tags headless ./... — all packages pass
  • CGO_ENABLED=0 go vet -tags headless ./... — pass
  • The three changed packages were also re-run with -count=1 and pass
  • git grep on the new tree finds zero hits for the old names, the old serials, 192.168.87., and the three old access codes

go test ./... and go vet ./... without -tags headless cannot build cmd/foxtrack-bridge on this machine (the tray UI needs cgo and pkg-config). Every other package still passes untagged.

Not tested

  • A real printer, a real config.json, or any live LAN or cloud connection
  • The tray/GUI build
  • Screenshot images (those are a separate PR)

History

The old values remain in git history. If an access code in those earlier commits was real, rotate it on the printer.

Public test files used real printer names, serials, LAN IPs, and access
codes. Swap them for clearly fake values so they cannot be mistaken for
live devices. Regenerated the MQTT discovery golden with go test -args
-update.

The old values remain in git history. If an access code in those
commits was real, rotate it on the printer.
@hacktron-app

hacktron-app Bot commented Dec 5, 2026

Copy link
Copy Markdown

Hacktron Security Check - Skipped

Reason: Code Review is not active for this organization

Start a free trial (no credit card required), subscribe, or add a payment method from organization billing settings

Go to: https://app.hacktron.ai/fox-track/billing

@FoxesRCool1
FoxesRCool1 merged commit 9a52a83 into main Dec 5, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant