@@ -17,10 +17,10 @@ import (
17
17
"github.com/ipfs/go-datastore"
18
18
cidlink "github.com/ipld/go-ipld-prime/linking/cid"
19
19
"github.com/ipni/go-libipni/metadata"
20
- "github.com/ipni/go-libipni/test"
21
20
drouting "github.com/ipni/index-provider/delegatedrouting"
22
21
"github.com/ipni/index-provider/engine"
23
22
mock_provider "github.com/ipni/index-provider/mock"
23
+ "github.com/ipni/test/random"
24
24
"github.com/libp2p/go-libp2p"
25
25
"github.com/libp2p/go-libp2p/core/crypto"
26
26
"github.com/libp2p/go-libp2p/core/peer"
@@ -54,7 +54,7 @@ func TestDelegatedRoutingMultihashLister(t *testing.T) {
54
54
cids [newCid ("test2" )] = struct {}{}
55
55
cids [newCid ("test3" )] = struct {}{}
56
56
57
- pID , _ , _ := test . RandomIdentity ()
57
+ pID , _ , _ := random . Identity ()
58
58
59
59
lister := & drouting.MultihashLister {
60
60
CidFetcher : func (contextID []byte ) (map [cid.Cid ]struct {}, error ) {
@@ -118,7 +118,7 @@ func TestProvideRoundtrip(t *testing.T) {
118
118
119
119
h , err := libp2p .New ()
120
120
require .NoError (t , err )
121
- pID , priv , _ := test . RandomIdentity ()
121
+ pID , priv , _ := random . Identity ()
122
122
123
123
ctx := context .Background ()
124
124
@@ -178,7 +178,7 @@ func TestProvideRoundtripWithRemove(t *testing.T) {
178
178
179
179
h , err := libp2p .New ()
180
180
require .NoError (t , err )
181
- pID , priv , _ := test . RandomIdentity ()
181
+ pID , priv , _ := random . Identity ()
182
182
ctx := context .Background ()
183
183
184
184
engine , err := engine .New (engine .WithHost (h ), engine .WithPublisherKind (engine .Libp2pPublisher ))
@@ -234,7 +234,7 @@ func TestAdvertiseTwoChunksWithOneCidInEach(t *testing.T) {
234
234
chunkSize := 1
235
235
snapshotSize := 1000
236
236
237
- pID , priv , _ := test . RandomIdentity ()
237
+ pID , priv , _ := random . Identity ()
238
238
239
239
ctx := context .Background ()
240
240
defer ctx .Done ()
@@ -265,7 +265,7 @@ func TestAdvertiseUsingAddrsFromParameters(t *testing.T) {
265
265
chunkSize := 1
266
266
snapshotSize := 1000
267
267
268
- pID , priv , _ := test . RandomIdentity ()
268
+ pID , priv , _ := random . Identity ()
269
269
270
270
ctx := context .Background ()
271
271
defer ctx .Done ()
@@ -300,7 +300,7 @@ func TestProvideRegistersCidInDatastore(t *testing.T) {
300
300
chunkSize := 2
301
301
snapshotSize := 1000
302
302
303
- pID , priv , _ := test . RandomIdentity ()
303
+ pID , priv , _ := random . Identity ()
304
304
305
305
ctx := context .Background ()
306
306
defer ctx .Done ()
@@ -335,7 +335,7 @@ func TestCidsAreOrderedByArrivalInExpiryQueue(t *testing.T) {
335
335
chunkSize := 1000
336
336
snapshotSize := 1000
337
337
338
- pID , priv , _ := test . RandomIdentity ()
338
+ pID , priv , _ := random . Identity ()
339
339
340
340
ctx := context .Background ()
341
341
defer ctx .Done ()
@@ -370,7 +370,7 @@ func TestFullChunkAdvertisedAndRegisteredInDatastore(t *testing.T) {
370
370
chunkSize := 2
371
371
snapshotSize := 1000
372
372
373
- pID , priv , _ := test . RandomIdentity ()
373
+ pID , priv , _ := random . Identity ()
374
374
375
375
ctx := context .Background ()
376
376
defer ctx .Done ()
@@ -407,7 +407,7 @@ func TestRemovedChunkIsRemovedFromIndexes(t *testing.T) {
407
407
chunkSize := 2
408
408
snapshotSize := 1000
409
409
410
- pID , priv , _ := test . RandomIdentity ()
410
+ pID , priv , _ := random . Identity ()
411
411
412
412
ctx := context .Background ()
413
413
defer ctx .Done ()
@@ -446,7 +446,7 @@ func TestAdvertiseOneChunkWithTwoCidsInIt(t *testing.T) {
446
446
chunkSize := 2
447
447
snapshotSize := 1000
448
448
449
- pID , priv , _ := test . RandomIdentity ()
449
+ pID , priv , _ := random . Identity ()
450
450
451
451
ctx := context .Background ()
452
452
defer ctx .Done ()
@@ -476,7 +476,7 @@ func TestDoNotReAdvertiseRepeatedCids(t *testing.T) {
476
476
chunkSize := 1
477
477
snapshotSize := 1000
478
478
479
- pID , priv , _ := test . RandomIdentity ()
479
+ pID , priv , _ := random . Identity ()
480
480
481
481
ctx := context .Background ()
482
482
defer ctx .Done ()
@@ -509,7 +509,7 @@ func TestAdvertiseExpiredCidsIfProvidedAgain(t *testing.T) {
509
509
chunkSize := 1
510
510
snapshotSize := 1000
511
511
512
- pID , priv , _ := test . RandomIdentity ()
512
+ pID , priv , _ := random . Identity ()
513
513
514
514
ctx := context .Background ()
515
515
defer ctx .Done ()
@@ -547,7 +547,7 @@ func TestRemoveExpiredCidAndReadvertiseChunk(t *testing.T) {
547
547
chunkSize := 2
548
548
snapshotSize := 1000
549
549
550
- pID , priv , _ := test . RandomIdentity ()
550
+ pID , priv , _ := random . Identity ()
551
551
552
552
ctx := context .Background ()
553
553
defer ctx .Done ()
@@ -591,7 +591,7 @@ func TestExpireMultipleChunks(t *testing.T) {
591
591
chunkSize := 1
592
592
snapshotSize := 1000
593
593
594
- pID , priv , _ := test . RandomIdentity ()
594
+ pID , priv , _ := random . Identity ()
595
595
596
596
ctx := context .Background ()
597
597
defer ctx .Done ()
@@ -629,7 +629,7 @@ func TestDoNotReadvertiseChunkIfAllCidsExpired(t *testing.T) {
629
629
chunkSize := 1
630
630
snapshotSize := 1000
631
631
632
- pID , priv , _ := test . RandomIdentity ()
632
+ pID , priv , _ := random . Identity ()
633
633
634
634
ctx := context .Background ()
635
635
defer ctx .Done ()
@@ -667,7 +667,7 @@ func TestDoNotReadvertiseTheSameCids(t *testing.T) {
667
667
chunkSize := 2
668
668
snapshotSize := 1000
669
669
670
- pID , priv , _ := test . RandomIdentity ()
670
+ pID , priv , _ := random . Identity ()
671
671
672
672
ctx := context .Background ()
673
673
defer ctx .Done ()
@@ -698,7 +698,7 @@ func TestDoNotLoadRemovedChunksOnInitialisation(t *testing.T) {
698
698
chunkSize := 1
699
699
snapshotSize := 1000
700
700
701
- pID , priv , _ := test . RandomIdentity ()
701
+ pID , priv , _ := random . Identity ()
702
702
703
703
ctx := context .Background ()
704
704
defer ctx .Done ()
@@ -738,7 +738,7 @@ func TestMissingCidTimestampsBackfilledOnIntialisation(t *testing.T) {
738
738
chunkSize := 1
739
739
snapshotSize := 1000
740
740
741
- pID , priv , _ := test . RandomIdentity ()
741
+ pID , priv , _ := random . Identity ()
742
742
743
743
ctx := context .Background ()
744
744
defer ctx .Done ()
@@ -804,7 +804,7 @@ func TestSameCidNotDuplicatedInTheCurrentChunkIfProvidedTwice(t *testing.T) {
804
804
chunkSize := 2
805
805
snapshotSize := 1000
806
806
807
- pID , priv , _ := test . RandomIdentity ()
807
+ pID , priv , _ := random . Identity ()
808
808
809
809
ctx := context .Background ()
810
810
defer ctx .Done ()
@@ -833,7 +833,7 @@ func TestShouldStoreSnapshotInDatastore(t *testing.T) {
833
833
ttl := time .Hour
834
834
chunkSize := 1000
835
835
836
- pID , priv , _ := test . RandomIdentity ()
836
+ pID , priv , _ := random . Identity ()
837
837
838
838
ctx := context .Background ()
839
839
defer ctx .Done ()
@@ -874,7 +874,7 @@ func TestShouldNotStoreSnapshotInDatastore(t *testing.T) {
874
874
ttl := time .Hour
875
875
chunkSize := 1000
876
876
877
- pID , priv , _ := test . RandomIdentity ()
877
+ pID , priv , _ := random . Identity ()
878
878
879
879
ctx := context .Background ()
880
880
defer ctx .Done ()
@@ -913,7 +913,7 @@ func TestShouldCleanUpTimestampMappingsFromDatastore(t *testing.T) {
913
913
ttl := time .Hour
914
914
chunkSize := 1000
915
915
916
- pID , priv , _ := test . RandomIdentity ()
916
+ pID , priv , _ := random . Identity ()
917
917
918
918
ctx := context .Background ()
919
919
defer ctx .Done ()
@@ -959,7 +959,7 @@ func TestShouldCorrectlyMergeSnapshotAndCidTimestamps(t *testing.T) {
959
959
ttl := time .Hour
960
960
chunkSize := 1000
961
961
962
- pID , priv , _ := test . RandomIdentity ()
962
+ pID , priv , _ := random . Identity ()
963
963
964
964
ctx := context .Background ()
965
965
defer ctx .Done ()
@@ -1011,7 +1011,7 @@ func TestInitialiseFromDatastoreWithSnapshot(t *testing.T) {
1011
1011
}
1012
1012
1013
1013
func verifyInitialisationFromDatastore (t * testing.T , snapshotSize int , ttl time.Duration , chunkSize int ) {
1014
- pID , priv , _ := test . RandomIdentity ()
1014
+ pID , priv , _ := random . Identity ()
1015
1015
// total number of test cids to generate
1016
1016
// - has to be not even so that not all of the cids end up included into chunks
1017
1017
// - has to span multiple page sizes so that datastore is initialised in pages
@@ -1101,7 +1101,7 @@ func TestCleanUpExpiredCidsThatDontHaveChunk(t *testing.T) {
1101
1101
ttl := time .Second
1102
1102
chunkSize := 2
1103
1103
snapshotSize := 1000
1104
- pID , priv , _ := test . RandomIdentity ()
1104
+ pID , priv , _ := random . Identity ()
1105
1105
1106
1106
ctx := context .Background ()
1107
1107
defer ctx .Done ()
@@ -1142,7 +1142,7 @@ func TestCidsWithoutChunkAreRegisteredInDsAndIndexes(t *testing.T) {
1142
1142
ttl := 1 * time .Hour
1143
1143
chunkSize := 2
1144
1144
snapshotSize := 1000
1145
- pID , priv , _ := test . RandomIdentity ()
1145
+ pID , priv , _ := random . Identity ()
1146
1146
1147
1147
ctx := context .Background ()
1148
1148
defer ctx .Done ()
@@ -1175,7 +1175,7 @@ func TestShouldSplitSnapshotIntoMultipleChunksAndReadThemBack(t *testing.T) {
1175
1175
1176
1176
h , err := libp2p .New ()
1177
1177
require .NoError (t , err )
1178
- pID , priv , _ := test . RandomIdentity ()
1178
+ pID , priv , _ := random . Identity ()
1179
1179
ctx := context .Background ()
1180
1180
1181
1181
engine , err := engine .New (engine .WithHost (h ), engine .WithPublisherKind (engine .Libp2pPublisher ))
@@ -1240,7 +1240,7 @@ func TestShouldCleanUpOldSnapshotChunksAfterStoringNewOnes(t *testing.T) {
1240
1240
1241
1241
h , err := libp2p .New ()
1242
1242
require .NoError (t , err )
1243
- pID , priv , _ := test . RandomIdentity ()
1243
+ pID , priv , _ := random . Identity ()
1244
1244
ctx := context .Background ()
1245
1245
1246
1246
engine , err := engine .New (engine .WithHost (h ), engine .WithPublisherKind (engine .Libp2pPublisher ))
@@ -1287,7 +1287,7 @@ func TestShouldRecogniseLegacySnapshot(t *testing.T) {
1287
1287
1288
1288
h , err := libp2p .New ()
1289
1289
require .NoError (t , err )
1290
- pID , priv , _ := test . RandomIdentity ()
1290
+ pID , priv , _ := random . Identity ()
1291
1291
ctx := context .Background ()
1292
1292
1293
1293
engine , err := engine .New (engine .WithHost (h ), engine .WithPublisherKind (engine .Libp2pPublisher ))
@@ -1347,7 +1347,7 @@ func TestAdsFlush(t *testing.T) {
1347
1347
chunkSize := 2
1348
1348
snapshotSize := 1000
1349
1349
adFlusFreq := 100 * time .Millisecond
1350
- pID , priv , _ := test . RandomIdentity ()
1350
+ pID , priv , _ := random . Identity ()
1351
1351
1352
1352
ctx := context .Background ()
1353
1353
defer ctx .Done ()
0 commit comments