Skip to content

Commit

Permalink
Merge fc5a6df into 5cdff2a
Browse files Browse the repository at this point in the history
  • Loading branch information
hsanjuan committed Oct 1, 2018
2 parents 5cdff2a + fc5a6df commit 7185d5e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions pintracker/pintracker_test.go
Expand Up @@ -202,6 +202,7 @@ var sortPinInfoByCid = func(p []api.PinInfo) {
func testSlowMapPinTracker(t testing.TB) *maptracker.MapPinTracker {
cfg := &maptracker.Config{}
cfg.Default()
cfg.ConcurrentPins = 1
mpt := maptracker.NewMapPinTracker(cfg, test.TestPeerID1, test.TestPeerName1)
mpt.SetClient(mockRPCClient(t))
return mpt
Expand All @@ -210,6 +211,7 @@ func testSlowMapPinTracker(t testing.TB) *maptracker.MapPinTracker {
func testMapPinTracker(t testing.TB) *maptracker.MapPinTracker {
cfg := &maptracker.Config{}
cfg.Default()
cfg.ConcurrentPins = 1
mpt := maptracker.NewMapPinTracker(cfg, test.TestPeerID1, test.TestPeerName1)
mpt.SetClient(test.NewMockRPCClient(t))
return mpt
Expand Down
9 changes: 8 additions & 1 deletion pintracker/stateless/stateless_test.go
Expand Up @@ -102,6 +102,7 @@ func (mock *mockService) PinGet(ctx context.Context, in api.PinSerial, out *api.
func testSlowStatelessPinTracker(t *testing.T) *Tracker {
cfg := &Config{}
cfg.Default()
cfg.ConcurrentPins = 1
mpt := New(cfg, test.TestPeerID1, test.TestPeerName1)
mpt.SetClient(mockRPCClient(t))
return mpt
Expand All @@ -110,6 +111,7 @@ func testSlowStatelessPinTracker(t *testing.T) *Tracker {
func testStatelessPinTracker(t testing.TB) *Tracker {
cfg := &Config{}
cfg.Default()
cfg.ConcurrentPins = 1
spt := New(cfg, test.TestPeerID1, test.TestPeerName1)
spt.SetClient(test.NewMockRPCClient(t))
return spt
Expand Down Expand Up @@ -193,6 +195,11 @@ func TestTrackUntrackWithCancel(t *testing.T) {
}
}

// This tracks a slow CID and then tracks a fast/normal one.
// Because we are pinning the slow CID, the fast one will stay
// queued. We proceed to untrack it then. Since it was never
// "pinning", it should simply be unqueued (or ignored), and no
// cancelling of the pinning operation happens (unlike on WithCancel).
func TestTrackUntrackWithNoCancel(t *testing.T) {
spt := testSlowStatelessPinTracker(t)
defer spt.Shutdown()
Expand Down Expand Up @@ -234,7 +241,7 @@ func TestTrackUntrackWithNoCancel(t *testing.T) {
// t.Fatal(ErrPinCancelCid)
// }
} else {
t.Error("fastPin should be queued to pin")
t.Errorf("fastPin should be queued to pin but is %s", fastPInfo.Status)
}

pi := spt.optracker.Get(fastPin.Cid)
Expand Down

0 comments on commit 7185d5e

Please sign in to comment.