1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-09-10 09:52:20 +08:00

Fix 'ctx, _' to have explicit cancel

License: MIT
Signed-off-by: rht <rhtbot@gmail.com>
This commit is contained in:
rht
2015-08-23 19:33:53 +07:00
parent 34e06f6c95
commit a7202fa94c
9 changed files with 37 additions and 23 deletions

View File

@ -210,21 +210,21 @@ func TestPinRecursiveFail(t *testing.T) {
}
// Note: this isnt a time based test, we expect the pin to fail
mctx, _ := context.WithTimeout(ctx, time.Millisecond)
mctx, cancel := context.WithTimeout(ctx, time.Millisecond)
defer cancel()
err = p.Pin(mctx, a, true)
if err == nil {
t.Fatal("should have failed to pin here")
}
_, err = dserv.Add(b)
if err != nil {
if _, err := dserv.Add(b); err != nil {
t.Fatal(err)
}
// this one is time based... but shouldnt cause any issues
mctx, _ = context.WithTimeout(ctx, time.Second)
err = p.Pin(mctx, a, true)
if err != nil {
mctx, cancel = context.WithTimeout(ctx, time.Second)
defer cancel()
if err := p.Pin(mctx, a, true); err != nil {
t.Fatal(err)
}
}