Repository navigation
Replace real-looking printer fixtures with fake test data - #3
Merged
Merged
Conversation
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 Security Check - SkippedReason: Code Review is not active for this organization
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.gofiles and one golden file are touched.What was replaced
Consistent mapping across every test and testdata file:
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.01P00C58…/01P00C59…serials became01P00TEST0000A1,01P00TEST0000B2,01P00TEST0000C3, and01P00TEST0000E5. They keep the01Pprefix and length sobambuSerialModelstill reports P1S. Already-fake serials such as01P00A000000001and01P00CLOUDPLUGwere left alone. A lowercase same-serial check was updated to01p00test0000a1.192.168.87.22/24/26/30became192.0.2.22/24/26/30. Three fixture IPs that sat on the same printers (192.168.1.5in the MQTT export test,192.168.1.6and192.168.1.7in the queue test) became192.0.2.5/6/7. Generic example IPs in docs, UI placeholders, and unrelated tests were not changed.12345678,23456789, and34567890. Already-dummy values such as12345678on other fixtures,SECRET-lan-1,newcode1, and one-character stubs were left alone.A share-status leak check that looked for
192.168now looks for192.0.2, so it still tests the fixture IP. A regression test request path was written as/api/printers/Test%20Printer%20Abecause a raw space breaks the test request; the handler still sees "Test Printer A".Golden file
mqttexport/mqttexport_test.godefines-updateas a test flag (flag.Bool("update", …)).go test -update ./mqttexport/does not work, becausego testtreats-updateas its own flag and then has no package path. The golden was regenerated with:It was not edited by hand. The only change in
mqttexport/testdata/discovery_bambu.golden.jsonis the printer name (13 places). The old serial was not in the golden.Tested
CGO_ENABLED=0 go test -tags headless ./...— all packages passCGO_ENABLED=0 go vet -tags headless ./...— pass-count=1and passgit grepon the new tree finds zero hits for the old names, the old serials,192.168.87., and the three old access codesgo test ./...andgo vet ./...without-tags headlesscannot buildcmd/foxtrack-bridgeon this machine (the tray UI needs cgo andpkg-config). Every other package still passes untagged.Not tested
config.json, or any live LAN or cloud connectionHistory
The old values remain in git history. If an access code in those earlier commits was real, rotate it on the printer.