Skip to content

Commit

Permalink
Reduces noise in golden image tests during failure
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbyttow committed Jan 18, 2021
1 parent 98d9500 commit 8b1ddb5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion vips/image_golden_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,8 @@ func assertGoldenMatch(t *testing.T, file string, buf []byte, format ImageType)

golden, _ := ioutil.ReadFile(goldenFile)
if golden != nil {
if !assert.Equal(t, golden, buf) {
sameAsGolden := assert.True(t, bytes.Equal(buf, golden), "Actual image (size=%d) didn't match expected golden file=%s (size=%d)", len(buf), goldenFile, len(golden))
if !sameAsGolden {
failed := prefix + "-" + getEnvironment() + ".failed" + ext
err := ioutil.WriteFile(failed, buf, 0666)
if err != nil {
Expand Down

0 comments on commit 8b1ddb5

Please sign in to comment.