@@ -23,8 +23,7 @@ func TestAsyncLoadInitialLoadSucceedsLocallyPresent(t *testing.T) {
23
23
link := st .Store (t , block )
24
24
withLoader (st , func (ctx context.Context , asyncLoader * AsyncLoader ) {
25
25
requestID := graphsync .NewRequestID ()
26
- p := testutil .GeneratePeers (1 )[0 ]
27
- resultChan := asyncLoader .AsyncLoad (p , requestID , link , ipld.LinkContext {})
26
+ resultChan := asyncLoader .AsyncLoad (requestID , link , ipld.LinkContext {})
28
27
assertSuccessResponse (ctx , t , resultChan )
29
28
st .AssertLocalLoads (t , 1 )
30
29
})
@@ -45,9 +44,8 @@ func TestAsyncLoadInitialLoadSucceedsResponsePresent(t *testing.T) {
45
44
Action : graphsync .LinkActionPresent ,
46
45
}}),
47
46
}
48
- p := testutil .GeneratePeers (1 )[0 ]
49
47
asyncLoader .ProcessResponse (context .Background (), responses , blocks )
50
- resultChan := asyncLoader .AsyncLoad (p , requestID , link , ipld.LinkContext {})
48
+ resultChan := asyncLoader .AsyncLoad (requestID , link , ipld.LinkContext {})
51
49
52
50
assertSuccessResponse (ctx , t , resultChan )
53
51
st .AssertLocalLoads (t , 0 )
@@ -68,10 +66,9 @@ func TestAsyncLoadInitialLoadFails(t *testing.T) {
68
66
Action : graphsync .LinkActionMissing ,
69
67
}}),
70
68
}
71
- p := testutil .GeneratePeers (1 )[0 ]
72
69
asyncLoader .ProcessResponse (context .Background (), responses , nil )
73
70
74
- resultChan := asyncLoader .AsyncLoad (p , requestID , link , ipld.LinkContext {})
71
+ resultChan := asyncLoader .AsyncLoad (requestID , link , ipld.LinkContext {})
75
72
assertFailResponse (ctx , t , resultChan )
76
73
st .AssertLocalLoads (t , 0 )
77
74
})
@@ -82,8 +79,7 @@ func TestAsyncLoadInitialLoadIndeterminateWhenRequestNotInProgress(t *testing.T)
82
79
withLoader (st , func (ctx context.Context , asyncLoader * AsyncLoader ) {
83
80
link := testutil .NewTestLink ()
84
81
requestID := graphsync .NewRequestID ()
85
- p := testutil .GeneratePeers (1 )[0 ]
86
- resultChan := asyncLoader .AsyncLoad (p , requestID , link , ipld.LinkContext {})
82
+ resultChan := asyncLoader .AsyncLoad (requestID , link , ipld.LinkContext {})
87
83
assertFailResponse (ctx , t , resultChan )
88
84
st .AssertLocalLoads (t , 1 )
89
85
})
@@ -100,8 +96,7 @@ func TestAsyncLoadInitialLoadIndeterminateThenSucceeds(t *testing.T) {
100
96
requestID := graphsync .NewRequestID ()
101
97
err := asyncLoader .StartRequest (requestID , "" )
102
98
require .NoError (t , err )
103
- p := testutil .GeneratePeers (1 )[0 ]
104
- resultChan := asyncLoader .AsyncLoad (p , requestID , link , ipld.LinkContext {})
99
+ resultChan := asyncLoader .AsyncLoad (requestID , link , ipld.LinkContext {})
105
100
106
101
st .AssertAttemptLoadWithoutResult (ctx , t , resultChan )
107
102
@@ -127,8 +122,7 @@ func TestAsyncLoadInitialLoadIndeterminateThenFails(t *testing.T) {
127
122
requestID := graphsync .NewRequestID ()
128
123
err := asyncLoader .StartRequest (requestID , "" )
129
124
require .NoError (t , err )
130
- p := testutil .GeneratePeers (1 )[0 ]
131
- resultChan := asyncLoader .AsyncLoad (p , requestID , link , ipld.LinkContext {})
125
+ resultChan := asyncLoader .AsyncLoad (requestID , link , ipld.LinkContext {})
132
126
133
127
st .AssertAttemptLoadWithoutResult (ctx , t , resultChan )
134
128
@@ -152,8 +146,7 @@ func TestAsyncLoadInitialLoadIndeterminateThenRequestFinishes(t *testing.T) {
152
146
requestID := graphsync .NewRequestID ()
153
147
err := asyncLoader .StartRequest (requestID , "" )
154
148
require .NoError (t , err )
155
- p := testutil .GeneratePeers (1 )[0 ]
156
- resultChan := asyncLoader .AsyncLoad (p , requestID , link , ipld.LinkContext {})
149
+ resultChan := asyncLoader .AsyncLoad (requestID , link , ipld.LinkContext {})
157
150
st .AssertAttemptLoadWithoutResult (ctx , t , resultChan )
158
151
asyncLoader .CompleteResponsesFor (requestID )
159
152
assertFailResponse (ctx , t , resultChan )
@@ -175,14 +168,13 @@ func TestAsyncLoadTwiceLoadsLocallySecondTime(t *testing.T) {
175
168
Action : graphsync .LinkActionPresent ,
176
169
}}),
177
170
}
178
- p := testutil .GeneratePeers (1 )[0 ]
179
171
asyncLoader .ProcessResponse (context .Background (), responses , blocks )
180
- resultChan := asyncLoader .AsyncLoad (p , requestID , link , ipld.LinkContext {})
172
+ resultChan := asyncLoader .AsyncLoad (requestID , link , ipld.LinkContext {})
181
173
182
174
assertSuccessResponse (ctx , t , resultChan )
183
175
st .AssertLocalLoads (t , 0 )
184
176
185
- resultChan = asyncLoader .AsyncLoad (p , requestID , link , ipld.LinkContext {})
177
+ resultChan = asyncLoader .AsyncLoad (requestID , link , ipld.LinkContext {})
186
178
assertSuccessResponse (ctx , t , resultChan )
187
179
st .AssertLocalLoads (t , 1 )
188
180
@@ -206,13 +198,12 @@ func TestRegisterUnregister(t *testing.T) {
206
198
requestID2 := graphsync .NewRequestID ()
207
199
err = asyncLoader .StartRequest (requestID2 , "other" )
208
200
require .NoError (t , err )
209
- p := testutil .GeneratePeers (1 )[0 ]
210
- resultChan1 := asyncLoader .AsyncLoad (p , requestID2 , link1 , ipld.LinkContext {})
201
+ resultChan1 := asyncLoader .AsyncLoad (requestID2 , link1 , ipld.LinkContext {})
211
202
assertSuccessResponse (ctx , t , resultChan1 )
212
203
err = asyncLoader .UnregisterPersistenceOption ("other" )
213
204
require .EqualError (t , err , "cannot unregister while requests are in progress" )
214
205
asyncLoader .CompleteResponsesFor (requestID2 )
215
- asyncLoader .CleanupRequest (p , requestID2 )
206
+ asyncLoader .CleanupRequest (requestID2 )
216
207
err = asyncLoader .UnregisterPersistenceOption ("other" )
217
208
require .NoError (t , err )
218
209
@@ -230,13 +221,12 @@ func TestRequestSplittingLoadLocallyFromBlockstore(t *testing.T) {
230
221
err := asyncLoader .RegisterPersistenceOption ("other" , otherSt .lsys )
231
222
require .NoError (t , err )
232
223
requestID1 := graphsync .NewRequestID ()
233
- p := testutil .GeneratePeers (1 )[0 ]
234
224
235
- resultChan1 := asyncLoader .AsyncLoad (p , requestID1 , link , ipld.LinkContext {})
225
+ resultChan1 := asyncLoader .AsyncLoad (requestID1 , link , ipld.LinkContext {})
236
226
requestID2 := graphsync .NewRequestID ()
237
227
err = asyncLoader .StartRequest (requestID2 , "other" )
238
228
require .NoError (t , err )
239
- resultChan2 := asyncLoader .AsyncLoad (p , requestID2 , link , ipld.LinkContext {})
229
+ resultChan2 := asyncLoader .AsyncLoad (requestID2 , link , ipld.LinkContext {})
240
230
241
231
assertFailResponse (ctx , t , resultChan1 )
242
232
assertSuccessResponse (ctx , t , resultChan2 )
@@ -259,9 +249,8 @@ func TestRequestSplittingSameBlockTwoStores(t *testing.T) {
259
249
require .NoError (t , err )
260
250
err = asyncLoader .StartRequest (requestID2 , "other" )
261
251
require .NoError (t , err )
262
- p := testutil .GeneratePeers (1 )[0 ]
263
- resultChan1 := asyncLoader .AsyncLoad (p , requestID1 , link , ipld.LinkContext {})
264
- resultChan2 := asyncLoader .AsyncLoad (p , requestID2 , link , ipld.LinkContext {})
252
+ resultChan1 := asyncLoader .AsyncLoad (requestID1 , link , ipld.LinkContext {})
253
+ resultChan2 := asyncLoader .AsyncLoad (requestID2 , link , ipld.LinkContext {})
265
254
responses := map [graphsync.RequestID ]graphsync.LinkMetadata {
266
255
requestID1 : message .NewLinkMetadata (
267
256
[]message.GraphSyncLinkMetadatum {{
@@ -298,9 +287,8 @@ func TestRequestSplittingSameBlockOnlyOneResponse(t *testing.T) {
298
287
require .NoError (t , err )
299
288
err = asyncLoader .StartRequest (requestID2 , "other" )
300
289
require .NoError (t , err )
301
- p := testutil .GeneratePeers (1 )[0 ]
302
- resultChan1 := asyncLoader .AsyncLoad (p , requestID1 , link , ipld.LinkContext {})
303
- resultChan2 := asyncLoader .AsyncLoad (p , requestID2 , link , ipld.LinkContext {})
290
+ resultChan1 := asyncLoader .AsyncLoad (requestID1 , link , ipld.LinkContext {})
291
+ resultChan2 := asyncLoader .AsyncLoad (requestID2 , link , ipld.LinkContext {})
304
292
responses := map [graphsync.RequestID ]graphsync.LinkMetadata {
305
293
requestID2 : message .NewLinkMetadata (
306
294
[]message.GraphSyncLinkMetadatum {{
0 commit comments