|
@@ -1,5 +1,5 @@
|
|
|
/*! Unit tests. Note that these require
|
|
|
-https://gitlab.torproject.org/vecna/lox-rs/-/tree/main/crates/lox-distributor
|
|
|
+https://gitlab.torproject.org/vecna/lox/-/tree/main/crates/lox-distributor
|
|
|
to be running. That fork adds an endpoint which allows for artificially
|
|
|
increasing the number of days that have passed, which allows us to test
|
|
|
trust migration and level up functions. */
|
|
@@ -19,6 +19,7 @@ use lox_library::proto::trust_promotion::UNTRUSTED_INTERVAL;
|
|
|
use lox_library::scalar_u32;
|
|
|
|
|
|
use std::cmp::min;
|
|
|
+use tokio::spawn;
|
|
|
|
|
|
// These are all combined into the same test because otherwise we run into
|
|
|
// issues with server state due to asynchronicity.
|
|
@@ -27,6 +28,9 @@ async fn test_credential_operations() {
|
|
|
let net = HyperNet {
|
|
|
hostname: "http://localhost:8001".to_string(),
|
|
|
};
|
|
|
+ let net_test = HyperNet {
|
|
|
+ hostname: "http://localhost:8005".to_string(),
|
|
|
+ };
|
|
|
let la_pubkeys = get_lox_auth_keys(&net).await;
|
|
|
|
|
|
// Get new Lox credential
|
|
@@ -43,7 +47,7 @@ async fn test_credential_operations() {
|
|
|
assert_eq!(scalar_u32(&cred.trust_level).unwrap(), 0);
|
|
|
|
|
|
// Advance server time and trust migrate
|
|
|
- advance_days(&net, u16::try_from(UNTRUSTED_INTERVAL).unwrap()).await;
|
|
|
+ advance_days(&net_test, u16::try_from(UNTRUSTED_INTERVAL).unwrap()).await;
|
|
|
assert!(eligible_for_trust_promotion(&net, &cred).await);
|
|
|
let migration_cred = trust_promotion(&net, &cred, get_lox_pub(&la_pubkeys)).await;
|
|
|
cred = trust_migration(
|
|
@@ -62,7 +66,7 @@ async fn test_credential_operations() {
|
|
|
scalar_u32(&cred.trust_level).unwrap(),
|
|
|
u32::try_from(i).unwrap()
|
|
|
);
|
|
|
- advance_days(&net, u16::try_from(LEVEL_INTERVAL[i]).unwrap()).await;
|
|
|
+ advance_days(&net_test, u16::try_from(LEVEL_INTERVAL[i]).unwrap()).await;
|
|
|
assert!(eligible_for_level_up(&net, &cred).await);
|
|
|
let encbuckets = get_reachability_credential(&net).await;
|
|
|
cred = level_up(
|