huskies: merge 629_refactor_migrate_commanddispatch_and_commandcontext_to_services_bundle
This commit is contained in:
@@ -36,3 +36,22 @@ pub struct Services {
|
||||
/// auto-denying (fail-closed).
|
||||
pub permission_timeout_secs: u64,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
impl Services {
|
||||
/// Build a minimal `Services` for testing with the given project root and
|
||||
/// bot display name.
|
||||
pub fn new_test(project_root: std::path::PathBuf, bot_name: String) -> std::sync::Arc<Self> {
|
||||
let (_perm_tx, perm_rx) = mpsc::unbounded_channel();
|
||||
std::sync::Arc::new(Self {
|
||||
project_root,
|
||||
agents: std::sync::Arc::new(crate::agents::AgentPool::new_test(3000)),
|
||||
bot_name,
|
||||
bot_user_id: String::new(),
|
||||
ambient_rooms: std::sync::Arc::new(std::sync::Mutex::new(HashSet::new())),
|
||||
perm_rx: std::sync::Arc::new(TokioMutex::new(perm_rx)),
|
||||
pending_perm_replies: std::sync::Arc::new(TokioMutex::new(HashMap::new())),
|
||||
permission_timeout_secs: 120,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user