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:
@ -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)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user