From 077641c8036015f444d0eeafd52e56676e4095db Mon Sep 17 00:00:00 2001 From: Heiko Schaefer Date: Mon, 17 Jul 2023 01:16:17 +0200 Subject: [PATCH] Adjust expected test result, and explain the difference --- .../pgpainless/wot/query/AuthenticateTests.kt | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/sequoia-wot-vectors/src/test/kotlin/org/pgpainless/wot/query/AuthenticateTests.kt b/sequoia-wot-vectors/src/test/kotlin/org/pgpainless/wot/query/AuthenticateTests.kt index 53e25a74..763bbfa2 100644 --- a/sequoia-wot-vectors/src/test/kotlin/org/pgpainless/wot/query/AuthenticateTests.kt +++ b/sequoia-wot-vectors/src/test/kotlin/org/pgpainless/wot/query/AuthenticateTests.kt @@ -317,11 +317,27 @@ class AuthenticateTest { Pair(20, listOf(t.aliceFpr, t.bobFpr, t.georgeFpr)), ), 240) + + // NOTE: original expectation from sequoia-wot: + // sp(q3, t.henryFpr, t.henryUid, + // listOf(Pair(60, listOf(t.aliceFpr, t.bobFpr, t.georgeFpr, t.henryFpr)), + // Pair(60, listOf(t.jennyFpr, t.georgeFpr, t.henryFpr)) + // ), null) + + // NOTE: Adjusted expectation for pgpainless. + // sequoia-wot searches for paths in a very specific way: + // backward_propagate() gets called twice in succession, from `authenticate()`, with two different search + // modes. The results get merged in a very specific way. In this test, that approach leads to a different + // distribution of trust amounts found for the two paths, which also happens to switch the ordering of the + // two paths. + // Note that the authentication result (the trust amount) remains unchanged, the total flow of 120 remains, + // it's just distributed differently between the two available paths. Both results are correct. sp(q3, t.henryFpr, t.henryUid, - listOf(Pair(60, listOf(t.aliceFpr, t.bobFpr, t.georgeFpr, t.henryFpr)), - Pair(60, listOf(t.jennyFpr, t.georgeFpr, t.henryFpr)) + listOf(Pair(100, listOf(t.jennyFpr, t.georgeFpr, t.henryFpr)), + Pair(20, listOf(t.aliceFpr, t.bobFpr, t.georgeFpr, t.henryFpr)) ), null) + sp(q3, t.isaacFpr, t.isaacUid, listOf(Pair(60, listOf(t.aliceFpr, t.bobFpr, t.georgeFpr, t.henryFpr, t.isaacFpr))), null) sp(q3, t.jennyFpr, t.jennyUid, listOf(Pair(120, listOf(t.jennyFpr))), null)