mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore(Makefile): update golden files as part of make gen (#17039)
Updating golden files is an unnecessary extra step in addition to gen that is easily overlooked, leading to the developer noticing the issue in CI leading to lost developer time waiting for tests to complete.
This commit is contained in:
@@ -1295,7 +1295,7 @@ func TestTemplateInsights_Golden(t *testing.T) {
|
||||
}
|
||||
|
||||
f, err := os.Open(goldenFile)
|
||||
require.NoError(t, err, "open golden file, run \"make update-golden-files\" and commit the changes")
|
||||
require.NoError(t, err, "open golden file, run \"make gen/golden-files\" and commit the changes")
|
||||
defer f.Close()
|
||||
var want codersdk.TemplateInsightsResponse
|
||||
err = json.NewDecoder(f).Decode(&want)
|
||||
@@ -1311,7 +1311,7 @@ func TestTemplateInsights_Golden(t *testing.T) {
|
||||
}),
|
||||
}
|
||||
// Use cmp.Diff here because it produces more readable diffs.
|
||||
assert.Empty(t, cmp.Diff(want, report, cmpOpts...), "golden file mismatch (-want +got): %s, run \"make update-golden-files\", verify and commit the changes", goldenFile)
|
||||
assert.Empty(t, cmp.Diff(want, report, cmpOpts...), "golden file mismatch (-want +got): %s, run \"make gen/golden-files\", verify and commit the changes", goldenFile)
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -2076,7 +2076,7 @@ func TestUserActivityInsights_Golden(t *testing.T) {
|
||||
}
|
||||
|
||||
f, err := os.Open(goldenFile)
|
||||
require.NoError(t, err, "open golden file, run \"make update-golden-files\" and commit the changes")
|
||||
require.NoError(t, err, "open golden file, run \"make gen/golden-files\" and commit the changes")
|
||||
defer f.Close()
|
||||
var want codersdk.UserActivityInsightsResponse
|
||||
err = json.NewDecoder(f).Decode(&want)
|
||||
@@ -2092,7 +2092,7 @@ func TestUserActivityInsights_Golden(t *testing.T) {
|
||||
}),
|
||||
}
|
||||
// Use cmp.Diff here because it produces more readable diffs.
|
||||
assert.Empty(t, cmp.Diff(want, report, cmpOpts...), "golden file mismatch (-want +got): %s, run \"make update-golden-files\", verify and commit the changes", goldenFile)
|
||||
assert.Empty(t, cmp.Diff(want, report, cmpOpts...), "golden file mismatch (-want +got): %s, run \"make gen/golden-files\", verify and commit the changes", goldenFile)
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
@@ -768,7 +768,7 @@ func TestNotificationTemplates_Golden(t *testing.T) {
|
||||
hello = "localhost"
|
||||
|
||||
from = "system@coder.com"
|
||||
hint = "run \"DB=ci make update-golden-files\" and commit the changes"
|
||||
hint = "run \"DB=ci make gen/golden-files\" and commit the changes"
|
||||
)
|
||||
|
||||
tests := []struct {
|
||||
|
||||
Reference in New Issue
Block a user