From df66daa5c92c1899d622f24573b2ca6c38ec7e20 Mon Sep 17 00:00:00 2001 From: greatroar <@> Date: Tue, 3 Mar 2020 17:53:24 +0100 Subject: [PATCH 1/4] Fix context usage in backend tests Found by go vet. This is also the only complaint is has. --- internal/backend/test/tests.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/internal/backend/test/tests.go b/internal/backend/test/tests.go index 7e9f7f5ab..6baa44f0e 100644 --- a/internal/backend/test/tests.go +++ b/internal/backend/test/tests.go @@ -412,13 +412,11 @@ func (s *Suite) TestListCancel(t *testing.T) { }) t.Run("Timeout", func(t *testing.T) { - ctx, cancel := context.WithCancel(context.TODO()) - defer cancel() - // rather large timeout, let's try to get at least one item timeout := time.Second - ctxTimeout, _ := context.WithTimeout(ctx, timeout) + ctxTimeout, cancel := context.WithTimeout(context.TODO(), timeout) + defer cancel() i := 0 // pass in a context with a timeout From 072cf7b02dc1005da924c07768765ad581d2465b Mon Sep 17 00:00:00 2001 From: greatroar <@> Date: Mon, 17 Feb 2020 16:26:08 +0100 Subject: [PATCH 2/4] Fix debug messages in internal/fuse --- internal/fuse/dir.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/fuse/dir.go b/internal/fuse/dir.go index f899a4313..2fe2c785e 100644 --- a/internal/fuse/dir.go +++ b/internal/fuse/dir.go @@ -111,7 +111,7 @@ func newDirFromSnapshot(ctx context.Context, root *Root, inode uint64, snapshot } func (d *dir) Attr(ctx context.Context, a *fuse.Attr) error { - debug.Log("called") + debug.Log("Attr()") a.Inode = d.inode a.Mode = os.ModeDir | d.node.Mode @@ -142,7 +142,7 @@ func (d *dir) calcNumberOfLinks() uint32 { } func (d *dir) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error) { - debug.Log("called") + debug.Log("ReadDirAll()") ret := make([]fuse.Dirent, 0, len(d.items)+2) ret = append(ret, fuse.Dirent{ From 8fb2c0d3c1379b12650a995d400e5e763bd3368d Mon Sep 17 00:00:00 2001 From: greatroar <@> Date: Fri, 6 Mar 2020 09:58:45 +0100 Subject: [PATCH 3/4] Typo in crypto test name --- internal/crypto/crypto_int_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/crypto/crypto_int_test.go b/internal/crypto/crypto_int_test.go index 769f34d1e..a370ef32e 100644 --- a/internal/crypto/crypto_int_test.go +++ b/internal/crypto/crypto_int_test.go @@ -164,7 +164,7 @@ func TestCrypto(t *testing.T) { } } -func TestNonceVadlid(t *testing.T) { +func TestNonceValid(t *testing.T) { nonce := make([]byte, ivSize) if validNonce(nonce) { From 2e31120f89b4a0907849d0efe6ec6b5613737d21 Mon Sep 17 00:00:00 2001 From: greatroar <@> Date: Mon, 9 Mar 2020 09:57:51 +0100 Subject: [PATCH 4/4] Remove unused argument to restic.fakeFile --- internal/restic/testing.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/restic/testing.go b/internal/restic/testing.go index 0cf7d171a..b7a107f09 100644 --- a/internal/restic/testing.go +++ b/internal/restic/testing.go @@ -15,7 +15,7 @@ import ( ) // fakeFile returns a reader which yields deterministic pseudo-random data. -func fakeFile(t testing.TB, seed, size int64) io.Reader { +func fakeFile(seed, size int64) io.Reader { return io.LimitReader(rand.New(rand.NewSource(seed)), size) } @@ -138,7 +138,7 @@ func (fs *fakeFileSystem) saveTree(ctx context.Context, seed int64, depth int) I Size: uint64(fileSize), } - node.Content = fs.saveFile(ctx, fakeFile(fs.t, fileSeed, fileSize)) + node.Content = fs.saveFile(ctx, fakeFile(fileSeed, fileSize)) tree.Nodes = append(tree.Nodes, node) }