Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(devices): update owner tests to use context-scoped dispatch

Steven Enamakelba5b66ad0c37
diff --git a/crates/openhuman-core/src/security/devices/owner_tests.rs b/crates/openhuman-core/src/security/devices/owner_tests.rs
index 12ab1f4ffa..0c78d211af 100644
--- a/crates/openhuman-core/src/security/devices/owner_tests.rs
+++ b/crates/openhuman-core/src/security/devices/owner_tests.rs
@@ -49,9 +49,8 @@ async fn a_remembered_owner_that_lost_the_device_is_forgotten() {
scoped_config(tmp.path()),
);
remember("owner-test-stale", None);
- let owner = crate::core::runtime::CoreContext::scope(
- context,
- owner_of(&DispatchCtx::process_default(), "owner-test-stale", None),
+ let owner = crate::core::runtime::CoreContext::scope(context.clone(),
+ owner_of(&DispatchCtx::new(context.clone()), "owner-test-stale", None),
)
.await;
assert_eq!(owner, Ok(None));
@@ -69,9 +68,8 @@ async fn a_revoked_device_is_not_its_agents_any_more() {
crate::core::runtime::DomainSet::full(),
config,
);
- let owner = crate::core::runtime::CoreContext::scope(
- context,
- owner_of(&DispatchCtx::process_default(), "owner-test-revoked", None),
+ let owner = crate::core::runtime::CoreContext::scope(context.clone(),
+ owner_of(&DispatchCtx::new(context.clone()), "owner-test-revoked", None),
)
.await;
assert_eq!(owner, Ok(None));
@@ -107,9 +105,8 @@ async fn a_device_found_in_the_local_scope_belongs_to_local_and_is_remembered()
crate::core::runtime::DomainSet::full(),
config,
);
- let owner = crate::core::runtime::CoreContext::scope(
- context,
- owner_of(&DispatchCtx::process_default(), "owner-test-found", None),
+ let owner = crate::core::runtime::CoreContext::scope(context.clone(),
+ owner_of(&DispatchCtx::new(context.clone()), "owner-test-found", None),
)
.await;
assert_eq!(owner, Ok(None));
@@ -123,9 +120,8 @@ async fn a_channel_no_scope_knows_is_local_and_not_remembered() {
crate::core::runtime::DomainSet::full(),
scoped_config(tmp.path()),
);
- let owner = crate::core::runtime::CoreContext::scope(
- context,
- owner_of(&DispatchCtx::process_default(), "owner-test-missing", None),
+ let owner = crate::core::runtime::CoreContext::scope(context.clone(),
+ owner_of(&DispatchCtx::new(context.clone()), "owner-test-missing", None),
)
.await;
assert_eq!(owner, Ok(None));
@@ -175,9 +171,8 @@ async fn a_revoked_device_with_a_live_cipher_is_dropped() {
super::super::crypto::TunnelCipher::new(&[7u8; 32]),
)),
);
- let owner = crate::core::runtime::CoreContext::scope(
- context,
- owner_of(&DispatchCtx::process_default(), "owner-test-cipher", None),
+ let owner = crate::core::runtime::CoreContext::scope(context.clone(),
+ owner_of(&DispatchCtx::new(context.clone()), "owner-test-cipher", None),
)
.await;
super::super::rpc::ACTIVE_CIPHERS
@@ -231,10 +226,9 @@ async fn a_leftover_pairing_session_does_not_outlive_a_revocation() {
super::super::store::insert_device(&config, "owner-test-leftover", "label", "pk", "hash")
.unwrap();
super::super::store::revoke_device(&config, "owner-test-leftover").unwrap();
- let owner = crate::core::runtime::CoreContext::scope(
- context,
+ let owner = crate::core::runtime::CoreContext::scope(context.clone(),
owner_of(
- &DispatchCtx::process_default(),
+ &DispatchCtx::new(context.clone()),
"owner-test-leftover",
Some(&pending),
),