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('set get dht value', testSetGetDHTValue);
test('open writer dht value', testOpenWriterDHTValue);
test('watch dht values',
() async => testWatchDHTValues(fixture.updateStream));
// xxx: needs to be a multi-server integration test
// test('watch dht values',
// () async => testWatchDHTValues(fixture.updateStream));
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));
}
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 {
final valueChangeQueue =
StreamController<VeilidUpdateValueChange>.broadcast();
@ -244,7 +275,6 @@ Future<void> testWatchDHTValues(Stream<VeilidUpdate> updateStream) async {
valueChangeQueue.sink.add(update);
}
});
var valueChangeQueueIterator = StreamIterator(valueChangeQueue.stream);
try {
// 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
// as the watch's target
final rcWatch = await Veilid.instance.routingContext();
final rcSet = await Veilid.instance
final rcSet = await Veilid.instance.routingContext();
final rcWatch = await Veilid.instance
.unsafeRoutingContext(sequencing: Sequencing.ensureOrdered);
try {
// 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')),
isNull);
// Wait for set to settle
await settle(rcWatch, rec.key, 3);
// Make a watch on that subkey
expect(await rcWatch.watchDHTValues(rec.key),
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
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
// is the same as our local copy
if (await valueChangeQueueIterator
.moveNext()
.timeout(const Duration(seconds: 5), onTimeout: () => false)) {
final update1 = await waitForValueChange(
valueChangeQueue.stream, const Duration(seconds: 10), () async {
// 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');
}
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
await valueChangeQueueIterator
.moveNext()
.timeout(const Duration(seconds: 10), onTimeout: () {
fail('should have a change');
final update2 = await waitForValueChange(
valueChangeQueue.stream, const Duration(seconds: 10), () async {
// Now set a subkey and trigger an update
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
expect(valueChangeQueueIterator.current.key, equals(rec.key));
expect(valueChangeQueueIterator.current.count, equals(0xFFFFFFFD));
expect(valueChangeQueueIterator.current.subkeys,
equals([ValueSubkeyRange.make(3, 4)]));
expect(valueChangeQueueIterator.current.value, isNull);
expect(update2.key, equals(rec.key));
expect(update2.count, equals(0xFFFFFFFD));
expect(update2.subkeys, equals([ValueSubkeyRange.single(3)]));
expect(update2.value, isNull);
// Reopen without closing to change routing context and not lose watch
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
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
await valueChangeQueueIterator
.moveNext()
.timeout(const Duration(seconds: 10), onTimeout: () {
fail('should have a change');
final update3 = await waitForValueChange(
valueChangeQueue.stream, const Duration(seconds: 10), () async {
// Now set multiple subkeys and trigger an update on one of them
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
// sequence number is the same
expect(valueChangeQueueIterator.current.key, equals(rec.key));
expect(valueChangeQueueIterator.current.count, equals(0xFFFFFFFC));
expect(valueChangeQueueIterator.current.subkeys,
equals([ValueSubkeyRange.single(3), ValueSubkeyRange.single(5)]));
expect(valueChangeQueueIterator.current.value, isNull);
expect(update3.key, equals(rec.key));
expect(update3.count, equals(0xFFFFFFFC));
expect(update3.subkeys, equals([ValueSubkeyRange.single(3)]));
expect(update3.value, isNull);
// Reopen without closing to change routing context and not lose watch
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
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 BLAH')),
rcSet.setDHTValue(rec.key, 5, utf8.encode('BZORT BZORT BZORT'))
].wait,
equals([null, null]));
// Wait for the update
final update4 = await waitForValueChange(
valueChangeQueue.stream, const Duration(seconds: 10), () async {
// Now set multiple subkeys that should not trigger an update
expect(
await [
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, 5);
// Now we should NOT get an update
if (await valueChangeQueueIterator
.moveNext()
.timeout(const Duration(seconds: 10), onTimeout: () => false)) {
await settle(rcSet, rec.key, 3);
await settle(rcSet, rec.key, 5);
});
if (update4 != null) {
fail('should not have a change');
}
@ -388,7 +413,6 @@ Future<void> testWatchDHTValues(Stream<VeilidUpdate> updateStream) async {
rcSet.close();
}
} finally {
await valueChangeQueueIterator.cancel();
await valueChangeSubscription.cancel();
await valueChangeQueue.close();
}

View File

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

View File

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

View File

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

View File

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