Normalize hostnames in goldens so that golden files work well for local tests too

This commit is contained in:
David Dworken 2023-12-09 15:12:40 -08:00
parent 0a8879997f
commit 8419a883b4
No known key found for this signature in database

View File

@ -362,6 +362,7 @@ func CompareGoldens(t testing.TB, out, goldenName string) {
out = normalizeHostnames(out) out = normalizeHostnames(out)
goldenPath := path.Join(initialWd, "client/lib/goldens/", goldenName) goldenPath := path.Join(initialWd, "client/lib/goldens/", goldenName)
expected, err := os.ReadFile(goldenPath) expected, err := os.ReadFile(goldenPath)
expected = []byte(normalizeHostnames(string(expected)))
if err != nil { if err != nil {
if os.IsNotExist(err) { if os.IsNotExist(err) {
expected = []byte("ERR_FILE_NOT_FOUND:" + goldenPath) expected = []byte("ERR_FILE_NOT_FOUND:" + goldenPath)