From d6af319ad815a1bc6fdeef6b6299d883fc5cb027 Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Tue, 20 Apr 2021 15:48:13 -0700 Subject: [PATCH] fix tests --- src/croc/croc.go | 3 +++ src/utils/utils_test.go | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/croc/croc.go b/src/croc/croc.go index 1c41c6d6..10ea2b83 100644 --- a/src/croc/croc.go +++ b/src/croc/croc.go @@ -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() diff --git a/src/utils/utils_test.go b/src/utils/utils_test.go index 28471488..a94fd7cc 100644 --- a/src/utils/utils_test.go +++ b/src/utils/utils_test.go @@ -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) {