mirror of https://github.com/schollz/croc.git
fix tests
This commit is contained in:
parent
85e7576311
commit
d6af319ad8
|
@ -224,6 +224,9 @@ func (c *Client) sendCollectFiles(options TransferOptions) (err error) {
|
||||||
}
|
}
|
||||||
log.Debugf("%+v", c.FilesToTransfer[i])
|
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)
|
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)
|
log.Debugf("hashed %s to %x using %s", fullPath, c.FilesToTransfer[i].Hash, c.Options.HashAlgorithm)
|
||||||
totalFilesSize += fstats.Size()
|
totalFilesSize += fstats.Size()
|
||||||
|
|
|
@ -175,9 +175,9 @@ func TestHashFile(t *testing.T) {
|
||||||
if err := tmpfile.Close(); err != nil {
|
if err := tmpfile.Close(); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
hashed, err := HashFile(tmpfile.Name())
|
hashed, err := HashFile(tmpfile.Name(), "xxhash")
|
||||||
assert.Nil(t, err)
|
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) {
|
func TestPublicIP(t *testing.T) {
|
||||||
|
|
Loading…
Reference in New Issue