mirror of
https://gitlab.com/veilid/veilid.git
synced 2025-08-10 15:40:39 -04:00
update api surface for create_dht_record with owner
This commit is contained in:
parent
bebdbee41b
commit
69378ca9b0
20 changed files with 206 additions and 88 deletions
|
@ -14,6 +14,7 @@ import 'test_veilid_config.dart';
|
|||
|
||||
void main() {
|
||||
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
final fixture =
|
||||
DefaultVeilidFixture(programName: 'veilid_flutter integration test');
|
||||
|
||||
|
@ -72,6 +73,7 @@ void main() {
|
|||
testCreateDeleteDHTRecordNoClose);
|
||||
test('get dht value nonexistent', testGetDHTValueNonexistent);
|
||||
test('set get dht value', testSetGetDHTValue);
|
||||
test('set get dht value with owner', testSetGetDHTValueWithOwner);
|
||||
test('open writer dht value', testOpenWriterDHTValue);
|
||||
// xxx: needs to be a multi-server integration test
|
||||
// test('watch dht values',
|
||||
|
|
|
@ -102,6 +102,33 @@ Future<void> testSetGetDHTValue() async {
|
|||
}
|
||||
}
|
||||
|
||||
Future<void> testSetGetDHTValueWithOwner() async {
|
||||
final rc = await Veilid.instance.routingContext();
|
||||
try {
|
||||
final cs = await Veilid.instance.bestCryptoSystem();
|
||||
final ownerKeyPair = await cs.generateKeyPair();
|
||||
|
||||
final rec = await rc.createDHTRecord(const DHTSchema.dflt(oCnt: 2),
|
||||
owner: ownerKeyPair);
|
||||
expect(await rc.setDHTValue(rec.key, 0, utf8.encode('BLAH BLAH BLAH')),
|
||||
isNull);
|
||||
final vd2 = await rc.getDHTValue(rec.key, 0);
|
||||
expect(vd2, isNotNull);
|
||||
|
||||
final vd3 = await rc.getDHTValue(rec.key, 0, forceRefresh: true);
|
||||
expect(vd3, isNotNull);
|
||||
|
||||
final vd4 = await rc.getDHTValue(rec.key, 1);
|
||||
expect(vd4, isNull);
|
||||
|
||||
expect(vd2, equals(vd3));
|
||||
|
||||
await rc.deleteDHTRecord(rec.key);
|
||||
} finally {
|
||||
rc.close();
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> testOpenWriterDHTValue() async {
|
||||
final rc = await Veilid.instance.routingContext();
|
||||
try {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue