2
2
mirror of https://github.com/octoleo/restic.git synced 2024-12-22 10:58:55 +00:00

Fix context usage in backend tests

Found by go vet. This is also the only complaint is has.
This commit is contained in:
greatroar 2020-03-03 17:53:24 +01:00
parent 9790d8ce1c
commit df66daa5c9

View File

@ -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