Skip to content

Commit b3cc8e5

Browse files
authored
chore: set timezone on all golden file make targets (coder#17533)
We replace timestamps in our golden files to keep the values constant. However, if a non-UTC timezone is used then the timestamp will still be replaced but the whitespace will be messed up (since it was aligned to the original value). ![image](https://github.com/user-attachments/assets/b7ebf615-5b41-41bb-8939-682a45a61952) Therefore we must force a timezone when generating golden files. Signed-off-by: Danny Kopping <dannykopping@gmail.com>
1 parent 35553a5 commit b3cc8e5

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

Makefile

+9-9
Original file line numberDiff line numberDiff line change
@@ -834,39 +834,39 @@ clean/golden-files:
834834
.PHONY: clean/golden-files
835835

836836
cli/testdata/.gen-golden: $(wildcard cli/testdata/*.golden) $(wildcard cli/*.tpl) $(GO_SRC_FILES) $(wildcard cli/*_test.go)
837-
go test ./cli -run="Test(CommandHelp|ServerYAML|ErrorExamples|.*Golden)" -update
837+
TZ=UTC go test ./cli -run="Test(CommandHelp|ServerYAML|ErrorExamples|.*Golden)" -update
838838
touch "$@"
839839

840840
enterprise/cli/testdata/.gen-golden: $(wildcard enterprise/cli/testdata/*.golden) $(wildcard cli/*.tpl) $(GO_SRC_FILES) $(wildcard enterprise/cli/*_test.go)
841-
go test ./enterprise/cli -run="TestEnterpriseCommandHelp" -update
841+
TZ=UTC go test ./enterprise/cli -run="TestEnterpriseCommandHelp" -update
842842
touch "$@"
843843

844844
tailnet/testdata/.gen-golden: $(wildcard tailnet/testdata/*.golden.html) $(GO_SRC_FILES) $(wildcard tailnet/*_test.go)
845-
go test ./tailnet -run="TestDebugTemplate" -update
845+
TZ=UTC go test ./tailnet -run="TestDebugTemplate" -update
846846
touch "$@"
847847

848848
enterprise/tailnet/testdata/.gen-golden: $(wildcard enterprise/tailnet/testdata/*.golden.html) $(GO_SRC_FILES) $(wildcard enterprise/tailnet/*_test.go)
849-
go test ./enterprise/tailnet -run="TestDebugTemplate" -update
849+
TZ=UTC go test ./enterprise/tailnet -run="TestDebugTemplate" -update
850850
touch "$@"
851851

852852
helm/coder/tests/testdata/.gen-golden: $(wildcard helm/coder/tests/testdata/*.yaml) $(wildcard helm/coder/tests/testdata/*.golden) $(GO_SRC_FILES) $(wildcard helm/coder/tests/*_test.go)
853-
go test ./helm/coder/tests -run=TestUpdateGoldenFiles -update
853+
TZ=UTC go test ./helm/coder/tests -run=TestUpdateGoldenFiles -update
854854
touch "$@"
855855

856856
helm/provisioner/tests/testdata/.gen-golden: $(wildcard helm/provisioner/tests/testdata/*.yaml) $(wildcard helm/provisioner/tests/testdata/*.golden) $(GO_SRC_FILES) $(wildcard helm/provisioner/tests/*_test.go)
857-
go test ./helm/provisioner/tests -run=TestUpdateGoldenFiles -update
857+
TZ=UTC go test ./helm/provisioner/tests -run=TestUpdateGoldenFiles -update
858858
touch "$@"
859859

860860
coderd/.gen-golden: $(wildcard coderd/testdata/*/*.golden) $(GO_SRC_FILES) $(wildcard coderd/*_test.go)
861-
go test ./coderd -run="Test.*Golden$$" -update
861+
TZ=UTC go test ./coderd -run="Test.*Golden$$" -update
862862
touch "$@"
863863

864864
coderd/notifications/.gen-golden: $(wildcard coderd/notifications/testdata/*/*.golden) $(GO_SRC_FILES) $(wildcard coderd/notifications/*_test.go)
865-
go test ./coderd/notifications -run="Test.*Golden$$" -update
865+
TZ=UTC go test ./coderd/notifications -run="Test.*Golden$$" -update
866866
touch "$@"
867867

868868
provisioner/terraform/testdata/.gen-golden: $(wildcard provisioner/terraform/testdata/*/*.golden) $(GO_SRC_FILES) $(wildcard provisioner/terraform/*_test.go)
869-
go test ./provisioner/terraform -run="Test.*Golden$$" -update
869+
TZ=UTC go test ./provisioner/terraform -run="Test.*Golden$$" -update
870870
touch "$@"
871871

872872
provisioner/terraform/testdata/version:

0 commit comments

Comments
 (0)