Fix #552: Pintracker tests were pinning in parallel
When we increased the default concurrency setting we forgot the tests are for ConcurrentPins=1. License: MIT Signed-off-by: Hector Sanjuan <code@hector.link>
This commit is contained in:
parent
5cdff2abc3
commit
fc5a6df3ad
|
@ -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
|
||||
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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()
|
||||
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user