@@ -6,6 +6,7 @@ const { create, replicate, unreplicate, eventFlush } = require('./helpers')
6
6
const { makeStreamPair } = require ( './helpers/networking.js' )
7
7
const Hypercore = require ( '../' )
8
8
9
+ /*
9
10
test('basic replication', async function (t) {
10
11
const a = await create()
11
12
@@ -1215,44 +1216,48 @@ test('cancel block', async function (t) {
1215
1216
await a.close()
1216
1217
await b.close()
1217
1218
})
1219
+ */
1218
1220
1219
- test ( 'try cancel block from a different session' , async function ( t ) {
1220
- t . plan ( 3 )
1221
+ for ( let i = 0 ; i < 100 ; i ++ ) {
1222
+ test ( 'try cancel block from a different session' , async function ( t ) {
1223
+ t . plan ( 3 )
1221
1224
1222
- const a = await create ( )
1223
- const b = await create ( a . key )
1225
+ const a = await create ( )
1226
+ const b = await create ( a . key )
1224
1227
1225
- await a . append ( [ 'a' , 'b' , 'c' ] )
1228
+ await a . append ( [ 'a' , 'b' , 'c' ] )
1226
1229
1227
- const [ n1 , n2 ] = makeStreamPair ( t , { latency : [ 50 , 50 ] } )
1228
- a . replicate ( n1 )
1229
- b . replicate ( n2 )
1230
+ const [ n1 , n2 ] = makeStreamPair ( t , { latency : [ 50 , 50 ] } )
1231
+ a . replicate ( n1 )
1232
+ b . replicate ( n2 )
1230
1233
1231
- const s1 = b . session ( )
1232
- const s2 = b . session ( )
1234
+ const s1 = b . session ( )
1235
+ const s2 = b . session ( )
1233
1236
1234
- const cancelling = waitForRequestBlock ( s1 ) . then ( ( ) => s1 . close ( ) )
1237
+ const cancelling = waitForRequestBlock ( s1 ) . then ( ( ) => s1 . close ( ) )
1235
1238
1236
- const b1 = s1 . get ( 0 )
1237
- const b2 = s2 . get ( 0 )
1239
+ const b1 = s1 . get ( 0 )
1240
+ const b2 = s2 . get ( 0 )
1238
1241
1239
- try {
1240
- await b1
1241
- t . fail ( 'Should have failed' )
1242
- } catch ( err ) {
1243
- t . is ( err . code , 'REQUEST_CANCELLED' )
1244
- }
1242
+ try {
1243
+ await b1
1244
+ t . fail ( 'Should have failed' )
1245
+ } catch ( err ) {
1246
+ t . is ( err . code , 'REQUEST_CANCELLED' )
1247
+ }
1245
1248
1246
- await cancelling
1249
+ await cancelling
1247
1250
1248
- t . alike ( await b2 , b4a . from ( 'a' ) )
1249
- t . alike ( await s2 . get ( 1 ) , b4a . from ( 'b' ) )
1250
- await s2 . close ( )
1251
+ t . alike ( await b2 , b4a . from ( 'a' ) )
1252
+ t . alike ( await s2 . get ( 1 ) , b4a . from ( 'b' ) )
1253
+ await s2 . close ( )
1251
1254
1252
- await a . close ( )
1253
- await b . close ( )
1254
- } )
1255
+ await a . close ( )
1256
+ await b . close ( )
1257
+ } )
1258
+ }
1255
1259
1260
+ /*
1256
1261
test('retry failed block requests to another peer', async function (t) {
1257
1262
t.plan(6)
1258
1263
@@ -1485,6 +1490,7 @@ test('replication updates on core copy', async function (t) {
1485
1490
1486
1491
await t.execution(promise)
1487
1492
})
1493
+ */
1488
1494
1489
1495
async function waitForRequestBlock ( core , opts ) {
1490
1496
while ( true ) {
0 commit comments