@@ -1216,42 +1216,44 @@ test('cancel block', async function (t) {
1216
1216
await b . close ( )
1217
1217
} )
1218
1218
1219
- test ( 'try cancel block from a different session' , async function ( t ) {
1220
- t . plan ( 3 )
1219
+ for ( let i = 0 ; i < 500 ; i ++ ) {
1220
+ test ( 'try cancel block from a different session' , async function ( t ) {
1221
+ t . plan ( 3 )
1221
1222
1222
- const a = await create ( )
1223
- const b = await create ( a . key )
1223
+ const a = await create ( )
1224
+ const b = await create ( a . key )
1224
1225
1225
- await a . append ( [ 'a' , 'b' , 'c' ] )
1226
+ await a . append ( [ 'a' , 'b' , 'c' ] )
1226
1227
1227
- const [ n1 , n2 ] = makeStreamPair ( t , { latency : [ 50 , 50 ] } )
1228
- a . replicate ( n1 )
1229
- b . replicate ( n2 )
1228
+ const [ n1 , n2 ] = makeStreamPair ( t , { latency : [ 50 , 50 ] } )
1229
+ a . replicate ( n1 )
1230
+ b . replicate ( n2 )
1230
1231
1231
- const s1 = b . session ( )
1232
- const s2 = b . session ( )
1232
+ const s1 = b . session ( )
1233
+ const s2 = b . session ( )
1233
1234
1234
- const cancelling = waitForRequestBlock ( s1 ) . then ( ( ) => s1 . close ( ) )
1235
+ const cancelling = waitForRequestBlock ( s1 ) . then ( ( ) => s1 . close ( ) )
1235
1236
1236
- const b1 = s1 . get ( 0 )
1237
- const b2 = s2 . get ( 0 )
1237
+ const b1 = s1 . get ( 0 )
1238
+ const b2 = s2 . get ( 0 )
1238
1239
1239
- try {
1240
- await b1
1241
- t . fail ( 'Should have failed' )
1242
- } catch ( err ) {
1243
- t . is ( err . code , 'REQUEST_CANCELLED' )
1244
- }
1240
+ try {
1241
+ await b1
1242
+ t . fail ( 'Should have failed' )
1243
+ } catch ( err ) {
1244
+ t . is ( err . code , 'REQUEST_CANCELLED' )
1245
+ }
1245
1246
1246
- await cancelling
1247
+ await cancelling
1247
1248
1248
- t . alike ( await b2 , b4a . from ( 'a' ) )
1249
- t . alike ( await s2 . get ( 1 ) , b4a . from ( 'b' ) )
1250
- await s2 . close ( )
1249
+ t . alike ( await b2 , b4a . from ( 'a' ) )
1250
+ t . alike ( await s2 . get ( 1 ) , b4a . from ( 'b' ) )
1251
+ await s2 . close ( )
1251
1252
1252
- await a . close ( )
1253
- await b . close ( )
1254
- } )
1253
+ await a . close ( )
1254
+ await b . close ( )
1255
+ } )
1256
+ }
1255
1257
1256
1258
test ( 'retry failed block requests to another peer' , async function ( t ) {
1257
1259
t . plan ( 6 )
0 commit comments