Skip to content
This repository has been archived by the owner on Sep 11, 2023. It is now read-only.

Commit

Permalink
Fix problem with fingerprint test
Browse files Browse the repository at this point in the history
  • Loading branch information
djaglowski committed May 21, 2021
1 parent e68195e commit e85de66
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions operator/builtin/input/file/fingerprint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,16 +254,23 @@ func TestFingerprintStartsWith_FromFile(t *testing.T) {
partialFile, err := ioutil.TempFile(tempDir, "")
require.NoError(t, err)

// Write the first byte before comparing, since empty files will never match
_, err = partialFile.Write(content[:1])
require.NoError(t, err)
content = content[1:]

// Write one byte at a time and validate that updated
// full fingerprint still starts with partial
for i := range content {
_, err = partialFile.Write(content[i:i])
require.NoError(t, err)

pff, err := operator.NewFingerprint(fullFile)
pff, err := operator.NewFingerprint(partialFile)
require.NoError(t, err)

require.True(t, fff.StartsWith(pff))
match := fff.StartsWith(pff)

require.True(t, match)
}
}

Expand Down

0 comments on commit e85de66

Please sign in to comment.