update dependencies

remove dysfunctional integration test
This commit is contained in:
Christien Rioux 2024-08-15 14:21:24 -04:00
parent ffa4825c19
commit 3716c5db78
7 changed files with 311 additions and 297 deletions

371
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -73,8 +73,9 @@ void main() {
test('get dht value nonexistent', testGetDHTValueNonexistent); test('get dht value nonexistent', testGetDHTValueNonexistent);
test('set get dht value', testSetGetDHTValue); test('set get dht value', testSetGetDHTValue);
test('open writer dht value', testOpenWriterDHTValue); test('open writer dht value', testOpenWriterDHTValue);
test('watch dht values', // xxx: needs to be a multi-server integration test
() async => testWatchDHTValues(fixture.updateStream)); // test('watch dht values',
// () async => testWatchDHTValues(fixture.updateStream));
test('inspect dht record', testInspectDHTRecord); test('inspect dht record', testInspectDHTRecord);
}); });
}); });

View File

@ -235,6 +235,37 @@ Future<void> settle(VeilidRoutingContext rc, TypedKey key, int subkey) async {
(await rc.inspectDHTRecord(key)).offlineSubkeys.containsSubkey(subkey)); (await rc.inspectDHTRecord(key)).offlineSubkeys.containsSubkey(subkey));
} }
Future<VeilidUpdateValueChange?> waitForValueChange(
Stream<VeilidUpdateValueChange> stream,
Duration duration,
Future<void> Function() closure) async {
final valueChangeQueueIterator = StreamIterator(stream);
try {
// Subscribe before call
final iterfut = valueChangeQueueIterator.moveNext();
// Call thing that might generate a value change
await closure();
// Wait for the first change
final hasChange =
await iterfut.timeout(duration, onTimeout: () async => false);
if (!hasChange) {
return null;
}
return valueChangeQueueIterator.current;
} finally {
// Stop waiting for changes
await valueChangeQueueIterator.cancel();
}
}
// XXX: Currently does not work because ValueChanged updates are suppressed
// for records that are the same sequence number locally as they are in the
// update. To properly test, you need two servers. Revisit this when we can
// make multiple veilid-core instantiations in a single process.
Future<void> testWatchDHTValues(Stream<VeilidUpdate> updateStream) async { Future<void> testWatchDHTValues(Stream<VeilidUpdate> updateStream) async {
final valueChangeQueue = final valueChangeQueue =
StreamController<VeilidUpdateValueChange>.broadcast(); StreamController<VeilidUpdateValueChange>.broadcast();
@ -244,7 +275,6 @@ Future<void> testWatchDHTValues(Stream<VeilidUpdate> updateStream) async {
valueChangeQueue.sink.add(update); valueChangeQueue.sink.add(update);
} }
}); });
var valueChangeQueueIterator = StreamIterator(valueChangeQueue.stream);
try { try {
// Make two routing contexts, one with and one without safety // Make two routing contexts, one with and one without safety
@ -252,8 +282,8 @@ Future<void> testWatchDHTValues(Stream<VeilidUpdate> updateStream) async {
// Normally they would not get sent if the set comes from the same target // Normally they would not get sent if the set comes from the same target
// as the watch's target // as the watch's target
final rcWatch = await Veilid.instance.routingContext(); final rcSet = await Veilid.instance.routingContext();
final rcSet = await Veilid.instance final rcWatch = await Veilid.instance
.unsafeRoutingContext(sequencing: Sequencing.ensureOrdered); .unsafeRoutingContext(sequencing: Sequencing.ensureOrdered);
try { try {
// Make a DHT record // Make a DHT record
@ -264,6 +294,9 @@ Future<void> testWatchDHTValues(Stream<VeilidUpdate> updateStream) async {
await rcWatch.setDHTValue(rec.key, 3, utf8.encode('BLAH BLAH BLAH')), await rcWatch.setDHTValue(rec.key, 3, utf8.encode('BLAH BLAH BLAH')),
isNull); isNull);
// Wait for set to settle
await settle(rcWatch, rec.key, 3);
// Make a watch on that subkey // Make a watch on that subkey
expect(await rcWatch.watchDHTValues(rec.key), expect(await rcWatch.watchDHTValues(rec.key),
isNot(equals(Timestamp.zero()))); isNot(equals(Timestamp.zero())));
@ -271,46 +304,39 @@ Future<void> testWatchDHTValues(Stream<VeilidUpdate> updateStream) async {
// Reopen without closing to change routing context and not lose watch // Reopen without closing to change routing context and not lose watch
rec = await rcSet.openDHTRecord(rec.key, writer: rec.ownerKeyPair()); rec = await rcSet.openDHTRecord(rec.key, writer: rec.ownerKeyPair());
// Now set the subkey and trigger an update
expect(await rcSet.setDHTValue(rec.key, 3, utf8.encode('BLAH')), isNull);
// Wait for set to settle
await settle(rcSet, rec.key, 3);
// Now we should NOT get an update because the update // Now we should NOT get an update because the update
// is the same as our local copy // is the same as our local copy
if (await valueChangeQueueIterator final update1 = await waitForValueChange(
.moveNext() valueChangeQueue.stream, const Duration(seconds: 10), () async {
.timeout(const Duration(seconds: 5), onTimeout: () => false)) { // Now set the subkey and trigger an update
expect(await rcSet.setDHTValue(rec.key, 3, utf8.encode('BLAH BLAH')),
isNull);
// Wait for set to settle
await settle(rcSet, rec.key, 3);
});
if (update1 != null) {
fail('should not have a change'); fail('should not have a change');
} }
await valueChangeQueueIterator.cancel();
valueChangeQueueIterator = StreamIterator(valueChangeQueue.stream);
// Now set multiple subkeys and trigger an update
expect(
await [
rcSet.setDHTValue(rec.key, 3, utf8.encode('BLAH BLAH')),
rcSet.setDHTValue(rec.key, 4, utf8.encode('BZORT'))
].wait,
equals([null, null]));
await settle(rcSet, rec.key, 3);
await settle(rcSet, rec.key, 4);
// Wait for the update // Wait for the update
await valueChangeQueueIterator final update2 = await waitForValueChange(
.moveNext() valueChangeQueue.stream, const Duration(seconds: 10), () async {
.timeout(const Duration(seconds: 10), onTimeout: () { // Now set a subkey and trigger an update
fail('should have a change'); expect(
await rcSet.setDHTValue(rec.key, 3, utf8.encode('BLAH')), isNull);
await settle(rcSet, rec.key, 3);
}); });
if (update2 == null) {
fail('should have a change');
}
// Verify the update // Verify the update
expect(valueChangeQueueIterator.current.key, equals(rec.key)); expect(update2.key, equals(rec.key));
expect(valueChangeQueueIterator.current.count, equals(0xFFFFFFFD)); expect(update2.count, equals(0xFFFFFFFD));
expect(valueChangeQueueIterator.current.subkeys, expect(update2.subkeys, equals([ValueSubkeyRange.single(3)]));
equals([ValueSubkeyRange.make(3, 4)])); expect(update2.value, isNull);
expect(valueChangeQueueIterator.current.value, isNull);
// Reopen without closing to change routing context and not lose watch // Reopen without closing to change routing context and not lose watch
rec = await rcWatch.openDHTRecord(rec.key, writer: rec.ownerKeyPair()); rec = await rcWatch.openDHTRecord(rec.key, writer: rec.ownerKeyPair());
@ -324,31 +350,30 @@ Future<void> testWatchDHTValues(Stream<VeilidUpdate> updateStream) async {
// Reopen without closing to change routing context and not lose watch // Reopen without closing to change routing context and not lose watch
rec = await rcSet.openDHTRecord(rec.key, writer: rec.ownerKeyPair()); rec = await rcSet.openDHTRecord(rec.key, writer: rec.ownerKeyPair());
// Now set multiple subkeys and trigger an update
expect(
await [
rcSet.setDHTValue(rec.key, 3, utf8.encode('BLAH BLAH BLAH')),
rcSet.setDHTValue(rec.key, 5, utf8.encode('BZORT BZORT'))
].wait,
equals([null, null]));
await settle(rcSet, rec.key, 3);
await settle(rcSet, rec.key, 5);
// Wait for the update // Wait for the update
await valueChangeQueueIterator final update3 = await waitForValueChange(
.moveNext() valueChangeQueue.stream, const Duration(seconds: 10), () async {
.timeout(const Duration(seconds: 10), onTimeout: () { // Now set multiple subkeys and trigger an update on one of them
fail('should have a change'); expect(
await [
rcSet.setDHTValue(rec.key, 3, utf8.encode('BLART')),
rcSet.setDHTValue(rec.key, 1, utf8.encode('BZORT BZORT'))
].wait,
equals([null, null]));
await settle(rcSet, rec.key, 3);
await settle(rcSet, rec.key, 1);
}); });
if (update3 == null) {
fail('should have a change');
}
// Verify the update came back but we don't get a new value because the // Verify the update came back but we don't get a new value because the
// sequence number is the same // sequence number is the same
expect(valueChangeQueueIterator.current.key, equals(rec.key)); expect(update3.key, equals(rec.key));
expect(valueChangeQueueIterator.current.count, equals(0xFFFFFFFC)); expect(update3.count, equals(0xFFFFFFFC));
expect(valueChangeQueueIterator.current.subkeys, expect(update3.subkeys, equals([ValueSubkeyRange.single(3)]));
equals([ValueSubkeyRange.single(3), ValueSubkeyRange.single(5)])); expect(update3.value, isNull);
expect(valueChangeQueueIterator.current.value, isNull);
// Reopen without closing to change routing context and not lose watch // Reopen without closing to change routing context and not lose watch
rec = await rcWatch.openDHTRecord(rec.key, writer: rec.ownerKeyPair()); rec = await rcWatch.openDHTRecord(rec.key, writer: rec.ownerKeyPair());
@ -362,21 +387,21 @@ Future<void> testWatchDHTValues(Stream<VeilidUpdate> updateStream) async {
// Reopen without closing to change routing context and not lose watch // Reopen without closing to change routing context and not lose watch
rec = await rcSet.openDHTRecord(rec.key, writer: rec.ownerKeyPair()); rec = await rcSet.openDHTRecord(rec.key, writer: rec.ownerKeyPair());
// Now set multiple subkeys and trigger an update // Wait for the update
expect( final update4 = await waitForValueChange(
await [ valueChangeQueue.stream, const Duration(seconds: 10), () async {
rcSet.setDHTValue(rec.key, 3, utf8.encode('BLAH BLAH BLAH BLAH')), // Now set multiple subkeys that should not trigger an update
rcSet.setDHTValue(rec.key, 5, utf8.encode('BZORT BZORT BZORT')) expect(
].wait, await [
equals([null, null])); rcSet.setDHTValue(rec.key, 3, utf8.encode('BLAH BLAH BLAH BLAH')),
rcSet.setDHTValue(rec.key, 5, utf8.encode('BZORT BZORT BZORT'))
].wait,
equals([null, null]));
await settle(rcSet, rec.key, 3); await settle(rcSet, rec.key, 3);
await settle(rcSet, rec.key, 5); await settle(rcSet, rec.key, 5);
});
// Now we should NOT get an update if (update4 != null) {
if (await valueChangeQueueIterator
.moveNext()
.timeout(const Duration(seconds: 10), onTimeout: () => false)) {
fail('should not have a change'); fail('should not have a change');
} }
@ -388,7 +413,6 @@ Future<void> testWatchDHTValues(Stream<VeilidUpdate> updateStream) async {
rcSet.close(); rcSet.close();
} }
} finally { } finally {
await valueChangeQueueIterator.cancel();
await valueChangeSubscription.cancel(); await valueChangeSubscription.cancel();
await valueChangeQueue.close(); await valueChangeQueue.close();
} }

View File

@ -31,7 +31,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS: SPEC CHECKSUMS:
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
integration_test: ce0a3ffa1de96d1a89ca0ac26fca7ea18a749ef4 integration_test: 252f60fa39af5e17c3aa9899d35d908a0721b573
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46 path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
system_info_plus: 5393c8da281d899950d751713575fbf91c7709aa system_info_plus: 5393c8da281d899950d751713575fbf91c7709aa
veilid: f5c2e662f91907b30cf95762619526ac3e4512fd veilid: f5c2e662f91907b30cf95762619526ac3e4512fd

View File

@ -1,7 +1,7 @@
import UIKit import UIKit
import Flutter import Flutter
@UIApplicationMain @main
@objc class AppDelegate: FlutterAppDelegate { @objc class AppDelegate: FlutterAppDelegate {
override func application( override func application(
_ application: UIApplication, _ application: UIApplication,

View File

@ -1,7 +1,7 @@
import Cocoa import Cocoa
import FlutterMacOS import FlutterMacOS
@NSApplicationMain @main
class AppDelegate: FlutterAppDelegate { class AppDelegate: FlutterAppDelegate {
override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
return true return true

View File

@ -5,10 +5,10 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
name: ansicolor name: ansicolor
sha256: "8bf17a8ff6ea17499e40a2d2542c2f481cd7615760c6d34065cb22bfd22e6880" sha256: "50e982d500bc863e1d703448afdbf9e5a72eb48840a4f766fa361ffd6877055f"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.0.2" version: "2.0.3"
async: async:
dependency: transitive dependency: transitive
description: description:
@ -21,10 +21,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: async_tools name: async_tools
sha256: "93df8b92d54d92e3323c630277e902b4ad4f05f798b55cfbc451e98c3e2fb7ba" sha256: bbded696bfcb1437d0ca510ac047f261f9c7494fea2c488dd32ba2800e7f49e8
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.1.6" version: "0.1.7"
boolean_selector: boolean_selector:
dependency: transitive dependency: transitive
description: description:
@ -109,10 +109,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: ffi name: ffi
sha256: "493f37e7df1804778ff3a53bd691d8692ddf69702cf4c1c1096a2e41b4779e21" sha256: "16ed7b077ef01ad6170a3d0c57caa4a112a38d7a2ed5602e0aca9ca6f3d98da6"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.2" version: "2.1.3"
file: file:
dependency: transitive dependency: transitive
description: description:
@ -161,10 +161,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: freezed_annotation name: freezed_annotation
sha256: c3fd9336eb55a38cc1bbd79ab17573113a8deccd0ecbbf926cca3c62803b5c2d sha256: c2e2d632dd9b8a2b7751117abcfc2b4888ecfe181bd9fca7170d9ef02e595fe2
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.4.1" version: "2.4.4"
fuchsia_remote_debug_protocol: fuchsia_remote_debug_protocol:
dependency: transitive dependency: transitive
description: flutter description: flutter
@ -195,18 +195,18 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: leak_tracker name: leak_tracker
sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a" sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "10.0.4" version: "10.0.5"
leak_tracker_flutter_testing: leak_tracker_flutter_testing:
dependency: transitive dependency: transitive
description: description:
name: leak_tracker_flutter_testing name: leak_tracker_flutter_testing
sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8" sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.0.3" version: "3.0.5"
leak_tracker_testing: leak_tracker_testing:
dependency: transitive dependency: transitive
description: description:
@ -251,18 +251,18 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: material_color_utilities name: material_color_utilities
sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.8.0" version: "0.11.1"
meta: meta:
dependency: transitive dependency: transitive
description: description:
name: meta name: meta
sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136" sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.12.0" version: "1.15.0"
path: path:
dependency: "direct main" dependency: "direct main"
description: description:
@ -275,18 +275,18 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
name: path_provider name: path_provider
sha256: c9e7d3a4cd1410877472158bee69963a4579f78b68c65a2b7d40d1a7a88bb161 sha256: fec0d61223fba3154d87759e3cc27fe2c8dc498f6386c6d6fc80d1afdd1bf378
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.3" version: "2.1.4"
path_provider_android: path_provider_android:
dependency: transitive dependency: transitive
description: description:
name: path_provider_android name: path_provider_android
sha256: bca87b0165ffd7cdb9cad8edd22d18d2201e886d9a9f19b4fb3452ea7df3a72a sha256: "6f01f8e37ec30b07bc424b4deabac37cacb1bc7e2e515ad74486039918a37eb7"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.2.6" version: "2.2.10"
path_provider_foundation: path_provider_foundation:
dependency: transitive dependency: transitive
description: description:
@ -315,18 +315,18 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: path_provider_windows name: path_provider_windows
sha256: "8bc9f22eee8690981c22aa7fc602f5c85b497a6fb2ceb35ee5a5e5ed85ad8170" sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.2.1" version: "2.3.0"
platform: platform:
dependency: transitive dependency: transitive
description: description:
name: platform name: platform
sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec" sha256: "9b71283fc13df574056616011fb138fd3b793ea47cc509c189a6c3fa5f8a1a65"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.1.4" version: "3.1.5"
plugin_platform_interface: plugin_platform_interface:
dependency: transitive dependency: transitive
description: description:
@ -424,10 +424,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: test_api name: test_api
sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f" sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.7.0" version: "0.7.2"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:
@ -462,10 +462,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: vm_service name: vm_service
sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec" sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "14.2.1" version: "14.2.4"
webdriver: webdriver:
dependency: transitive dependency: transitive
description: description:
@ -474,14 +474,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.0.3" version: "3.0.3"
win32:
dependency: transitive
description:
name: win32
sha256: a79dbe579cb51ecd6d30b17e0cae4e0ea15e2c0e66f69ad4198f22a6789e94f4
url: "https://pub.dev"
source: hosted
version: "5.5.1"
xdg_directories: xdg_directories:
dependency: transitive dependency: transitive
description: description: