fix tests

This commit is contained in:
Zack Scholl 2021-04-20 15:48:13 -07:00
parent 85e7576311
commit d6af319ad8
2 changed files with 5 additions and 2 deletions

View File

@ -224,6 +224,9 @@ func (c *Client) sendCollectFiles(options TransferOptions) (err error) {
}
log.Debugf("%+v", c.FilesToTransfer[i])
}
if c.Options.HashAlgorithm == "" {
c.Options.HashAlgorithm = "xxhash"
}
c.FilesToTransfer[i].Hash, err = utils.HashFile(fullPath, c.Options.HashAlgorithm)
log.Debugf("hashed %s to %x using %s", fullPath, c.FilesToTransfer[i].Hash, c.Options.HashAlgorithm)
totalFilesSize += fstats.Size()

View File

@ -175,9 +175,9 @@ func TestHashFile(t *testing.T) {
if err := tmpfile.Close(); err != nil {
panic(err)
}
hashed, err := HashFile(tmpfile.Name())
hashed, err := HashFile(tmpfile.Name(), "xxhash")
assert.Nil(t, err)
assert.Equal(t, "18c9673a4bb8325d323e7f24fda9ae1e", fmt.Sprintf("%x", hashed))
assert.Equal(t, "e66c561610ad51e2", fmt.Sprintf("%x", hashed))
}
func TestPublicIP(t *testing.T) {