mirror of
https://gitlab.com/veilid/veilidchat.git
synced 2025-08-17 02:10:28 -04:00
fix eventual consistency
This commit is contained in:
parent
2c3d4dce93
commit
b5612e5dd8
23 changed files with 309 additions and 296 deletions
|
@ -36,161 +36,161 @@ void main() {
|
|||
setUpAll(veilidFixture.attach);
|
||||
tearDownAll(veilidFixture.detach);
|
||||
|
||||
group('TableDB Tests', () {
|
||||
group('TableDBArray Tests', () {
|
||||
// test('create/delete TableDBArray', testTableDBArrayCreateDelete);
|
||||
// group('TableDB Tests', () {
|
||||
// group('TableDBArray Tests', () {
|
||||
// // test('create/delete TableDBArray', testTableDBArrayCreateDelete);
|
||||
|
||||
group('TableDBArray Add/Get Tests', () {
|
||||
for (final params in [
|
||||
//
|
||||
(99, 3, 15),
|
||||
(100, 4, 16),
|
||||
(101, 5, 17),
|
||||
//
|
||||
(511, 3, 127),
|
||||
(512, 4, 128),
|
||||
(513, 5, 129),
|
||||
//
|
||||
(4095, 3, 1023),
|
||||
(4096, 4, 1024),
|
||||
(4097, 5, 1025),
|
||||
//
|
||||
(65535, 3, 16383),
|
||||
(65536, 4, 16384),
|
||||
(65537, 5, 16385),
|
||||
]) {
|
||||
final count = params.$1;
|
||||
final singles = params.$2;
|
||||
final batchSize = params.$3;
|
||||
// group('TableDBArray Add/Get Tests', () {
|
||||
// for (final params in [
|
||||
// //
|
||||
// (99, 3, 15),
|
||||
// (100, 4, 16),
|
||||
// (101, 5, 17),
|
||||
// //
|
||||
// (511, 3, 127),
|
||||
// (512, 4, 128),
|
||||
// (513, 5, 129),
|
||||
// //
|
||||
// (4095, 3, 1023),
|
||||
// (4096, 4, 1024),
|
||||
// (4097, 5, 1025),
|
||||
// //
|
||||
// (65535, 3, 16383),
|
||||
// (65536, 4, 16384),
|
||||
// (65537, 5, 16385),
|
||||
// ]) {
|
||||
// final count = params.$1;
|
||||
// final singles = params.$2;
|
||||
// final batchSize = params.$3;
|
||||
|
||||
test(
|
||||
timeout: const Timeout(Duration(seconds: 480)),
|
||||
'add/remove TableDBArray count = $count batchSize=$batchSize',
|
||||
makeTestTableDBArrayAddGetClear(
|
||||
count: count,
|
||||
singles: singles,
|
||||
batchSize: batchSize,
|
||||
crypto: const VeilidCryptoPublic()),
|
||||
);
|
||||
}
|
||||
});
|
||||
// test(
|
||||
// timeout: const Timeout(Duration(seconds: 480)),
|
||||
// 'add/remove TableDBArray count = $count batchSize=$batchSize',
|
||||
// makeTestTableDBArrayAddGetClear(
|
||||
// count: count,
|
||||
// singles: singles,
|
||||
// batchSize: batchSize,
|
||||
// crypto: const VeilidCryptoPublic()),
|
||||
// );
|
||||
// }
|
||||
// });
|
||||
|
||||
group('TableDBArray Insert Tests', () {
|
||||
for (final params in [
|
||||
//
|
||||
(99, 3, 15),
|
||||
(100, 4, 16),
|
||||
(101, 5, 17),
|
||||
//
|
||||
(511, 3, 127),
|
||||
(512, 4, 128),
|
||||
(513, 5, 129),
|
||||
//
|
||||
(4095, 3, 1023),
|
||||
(4096, 4, 1024),
|
||||
(4097, 5, 1025),
|
||||
//
|
||||
(65535, 3, 16383),
|
||||
(65536, 4, 16384),
|
||||
(65537, 5, 16385),
|
||||
]) {
|
||||
final count = params.$1;
|
||||
final singles = params.$2;
|
||||
final batchSize = params.$3;
|
||||
// group('TableDBArray Insert Tests', () {
|
||||
// for (final params in [
|
||||
// //
|
||||
// (99, 3, 15),
|
||||
// (100, 4, 16),
|
||||
// (101, 5, 17),
|
||||
// //
|
||||
// (511, 3, 127),
|
||||
// (512, 4, 128),
|
||||
// (513, 5, 129),
|
||||
// //
|
||||
// (4095, 3, 1023),
|
||||
// (4096, 4, 1024),
|
||||
// (4097, 5, 1025),
|
||||
// //
|
||||
// (65535, 3, 16383),
|
||||
// (65536, 4, 16384),
|
||||
// (65537, 5, 16385),
|
||||
// ]) {
|
||||
// final count = params.$1;
|
||||
// final singles = params.$2;
|
||||
// final batchSize = params.$3;
|
||||
|
||||
test(
|
||||
timeout: const Timeout(Duration(seconds: 480)),
|
||||
'insert TableDBArray count=$count singles=$singles batchSize=$batchSize',
|
||||
makeTestTableDBArrayInsert(
|
||||
count: count,
|
||||
singles: singles,
|
||||
batchSize: batchSize,
|
||||
crypto: const VeilidCryptoPublic()),
|
||||
);
|
||||
}
|
||||
});
|
||||
// test(
|
||||
// timeout: const Timeout(Duration(seconds: 480)),
|
||||
// 'insert TableDBArray count=$count singles=$singles batchSize=$batchSize',
|
||||
// makeTestTableDBArrayInsert(
|
||||
// count: count,
|
||||
// singles: singles,
|
||||
// batchSize: batchSize,
|
||||
// crypto: const VeilidCryptoPublic()),
|
||||
// );
|
||||
// }
|
||||
// });
|
||||
|
||||
group('TableDBArray Remove Tests', () {
|
||||
for (final params in [
|
||||
//
|
||||
(99, 3, 15),
|
||||
(100, 4, 16),
|
||||
(101, 5, 17),
|
||||
//
|
||||
(511, 3, 127),
|
||||
(512, 4, 128),
|
||||
(513, 5, 129),
|
||||
//
|
||||
(4095, 3, 1023),
|
||||
(4096, 4, 1024),
|
||||
(4097, 5, 1025),
|
||||
//
|
||||
(16383, 3, 4095),
|
||||
(16384, 4, 4096),
|
||||
(16385, 5, 4097),
|
||||
]) {
|
||||
final count = params.$1;
|
||||
final singles = params.$2;
|
||||
final batchSize = params.$3;
|
||||
// group('TableDBArray Remove Tests', () {
|
||||
// for (final params in [
|
||||
// //
|
||||
// (99, 3, 15),
|
||||
// (100, 4, 16),
|
||||
// (101, 5, 17),
|
||||
// //
|
||||
// (511, 3, 127),
|
||||
// (512, 4, 128),
|
||||
// (513, 5, 129),
|
||||
// //
|
||||
// (4095, 3, 1023),
|
||||
// (4096, 4, 1024),
|
||||
// (4097, 5, 1025),
|
||||
// //
|
||||
// (16383, 3, 4095),
|
||||
// (16384, 4, 4096),
|
||||
// (16385, 5, 4097),
|
||||
// ]) {
|
||||
// final count = params.$1;
|
||||
// final singles = params.$2;
|
||||
// final batchSize = params.$3;
|
||||
|
||||
test(
|
||||
timeout: const Timeout(Duration(seconds: 480)),
|
||||
'remove TableDBArray count=$count singles=$singles batchSize=$batchSize',
|
||||
makeTestTableDBArrayRemove(
|
||||
count: count,
|
||||
singles: singles,
|
||||
batchSize: batchSize,
|
||||
crypto: const VeilidCryptoPublic()),
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// group('DHT Support Tests', () {
|
||||
// setUpAll(updateProcessorFixture.setUp);
|
||||
// setUpAll(tickerFixture.setUp);
|
||||
// tearDownAll(tickerFixture.tearDown);
|
||||
// tearDownAll(updateProcessorFixture.tearDown);
|
||||
|
||||
// test('create pool', testDHTRecordPoolCreate);
|
||||
|
||||
// group('DHTRecordPool Tests', () {
|
||||
// setUpAll(dhtRecordPoolFixture.setUp);
|
||||
// tearDownAll(dhtRecordPoolFixture.tearDown);
|
||||
|
||||
// test('create/delete record', testDHTRecordCreateDelete);
|
||||
// test('record scopes', testDHTRecordScopes);
|
||||
// test('create/delete deep record', testDHTRecordDeepCreateDelete);
|
||||
// });
|
||||
|
||||
// group('DHTShortArray Tests', () {
|
||||
// setUpAll(dhtRecordPoolFixture.setUp);
|
||||
// tearDownAll(dhtRecordPoolFixture.tearDown);
|
||||
|
||||
// for (final stride in [256, 16 /*64, 32, 16, 8, 4, 2, 1 */]) {
|
||||
// test('create shortarray stride=$stride',
|
||||
// makeTestDHTShortArrayCreateDelete(stride: stride));
|
||||
// test('add shortarray stride=$stride',
|
||||
// makeTestDHTShortArrayAdd(stride: stride));
|
||||
// }
|
||||
// });
|
||||
|
||||
// group('DHTLog Tests', () {
|
||||
// setUpAll(dhtRecordPoolFixture.setUp);
|
||||
// tearDownAll(dhtRecordPoolFixture.tearDown);
|
||||
|
||||
// for (final stride in [256, 16 /*64, 32, 16, 8, 4, 2, 1 */]) {
|
||||
// test('create log stride=$stride',
|
||||
// makeTestDHTLogCreateDelete(stride: stride));
|
||||
// test(
|
||||
// timeout: const Timeout(Duration(seconds: 480)),
|
||||
// 'add/truncate log stride=$stride',
|
||||
// makeTestDHTLogAddTruncate(stride: stride),
|
||||
// );
|
||||
// }
|
||||
// test(
|
||||
// timeout: const Timeout(Duration(seconds: 480)),
|
||||
// 'remove TableDBArray count=$count singles=$singles batchSize=$batchSize',
|
||||
// makeTestTableDBArrayRemove(
|
||||
// count: count,
|
||||
// singles: singles,
|
||||
// batchSize: batchSize,
|
||||
// crypto: const VeilidCryptoPublic()),
|
||||
// );
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
// });
|
||||
|
||||
group('DHT Support Tests', () {
|
||||
setUpAll(updateProcessorFixture.setUp);
|
||||
setUpAll(tickerFixture.setUp);
|
||||
tearDownAll(tickerFixture.tearDown);
|
||||
tearDownAll(updateProcessorFixture.tearDown);
|
||||
|
||||
test('create pool', testDHTRecordPoolCreate);
|
||||
|
||||
group('DHTRecordPool Tests', () {
|
||||
setUpAll(dhtRecordPoolFixture.setUp);
|
||||
tearDownAll(dhtRecordPoolFixture.tearDown);
|
||||
|
||||
test('create/delete record', testDHTRecordCreateDelete);
|
||||
test('record scopes', testDHTRecordScopes);
|
||||
test('create/delete deep record', testDHTRecordDeepCreateDelete);
|
||||
});
|
||||
|
||||
group('DHTShortArray Tests', () {
|
||||
setUpAll(dhtRecordPoolFixture.setUp);
|
||||
tearDownAll(dhtRecordPoolFixture.tearDown);
|
||||
|
||||
for (final stride in [256, 16 /*64, 32, 16, 8, 4, 2, 1 */]) {
|
||||
test('create shortarray stride=$stride',
|
||||
makeTestDHTShortArrayCreateDelete(stride: stride));
|
||||
test('add shortarray stride=$stride',
|
||||
makeTestDHTShortArrayAdd(stride: stride));
|
||||
}
|
||||
});
|
||||
|
||||
group('DHTLog Tests', () {
|
||||
setUpAll(dhtRecordPoolFixture.setUp);
|
||||
tearDownAll(dhtRecordPoolFixture.tearDown);
|
||||
|
||||
for (final stride in [256, 16 /*64, 32, 16, 8, 4, 2, 1 */]) {
|
||||
test('create log stride=$stride',
|
||||
makeTestDHTLogCreateDelete(stride: stride));
|
||||
test(
|
||||
timeout: const Timeout(Duration(seconds: 480)),
|
||||
'add/truncate log stride=$stride',
|
||||
makeTestDHTLogAddTruncate(stride: stride),
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -64,8 +64,7 @@ Future<void> Function() makeTestDHTLogAddTruncate({required int stride}) =>
|
|||
const chunk = 25;
|
||||
for (var n = 0; n < dataset.length; n += chunk) {
|
||||
print('$n-${n + chunk - 1} ');
|
||||
final success = await w.tryAddAll(dataset.sublist(n, n + chunk));
|
||||
expect(success, isTrue);
|
||||
await w.addAll(dataset.sublist(n, n + chunk));
|
||||
}
|
||||
});
|
||||
expect(res, isNull);
|
||||
|
|
|
@ -64,7 +64,7 @@ Future<void> Function() makeTestDHTShortArrayAdd({required int stride}) =>
|
|||
for (var n = 4; n < 8; n++) {
|
||||
await arr.operateWriteEventual((w) async {
|
||||
print('$n ');
|
||||
return w.tryAdd(dataset[n]);
|
||||
await w.add(dataset[n]);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -73,8 +73,7 @@ Future<void> Function() makeTestDHTShortArrayAdd({required int stride}) =>
|
|||
{
|
||||
await arr.operateWriteEventual((w) async {
|
||||
print('${dataset.length ~/ 2}-${dataset.length}');
|
||||
return w
|
||||
.tryAddAll(dataset.sublist(dataset.length ~/ 2, dataset.length));
|
||||
await w.addAll(dataset.sublist(dataset.length ~/ 2, dataset.length));
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -83,7 +82,7 @@ Future<void> Function() makeTestDHTShortArrayAdd({required int stride}) =>
|
|||
for (var n = 0; n < 4; n++) {
|
||||
await arr.operateWriteEventual((w) async {
|
||||
print('$n ');
|
||||
return w.tryInsert(n, dataset[n]);
|
||||
await w.insert(n, dataset[n]);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -92,7 +91,7 @@ Future<void> Function() makeTestDHTShortArrayAdd({required int stride}) =>
|
|||
{
|
||||
await arr.operateWriteEventual((w) async {
|
||||
print('8-${dataset.length ~/ 2}');
|
||||
return w.tryInsertAll(8, dataset.sublist(8, dataset.length ~/ 2));
|
||||
await w.insertAll(8, dataset.sublist(8, dataset.length ~/ 2));
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -111,7 +110,6 @@ Future<void> Function() makeTestDHTShortArrayAdd({required int stride}) =>
|
|||
{
|
||||
await arr.operateWriteEventual((w) async {
|
||||
await w.clear();
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue