Skip to content

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

feat(cron): add client testing and scheduler dispatch tests

Steven Enamakel5b14fe9084fa
diff --git a/crates/openhuman-core/src/cron/client_testing.rs b/crates/openhuman-core/src/cron/client_testing.rs
index e21bdd7809..751928ca6d 100644
--- a/crates/openhuman-core/src/cron/client_testing.rs
+++ b/crates/openhuman-core/src/cron/client_testing.rs
@@ -6,13 +6,11 @@ use crate::storage::{Scope, StorageBackend};
use std::sync::Arc;
use tinyflows_bus::schedule::types::CronRun;
-fn run<T: Send + 'static>(
+fn run<T: Send + DeserializeOwned + 'static>(
backend: &Arc<dyn StorageBackend>,
scope: &Scope,
operation: StoreOperation,
) -> Result<T>
-where
- T: DeserializeOwned,
{
let config = Config::default();
let scope = DocScope::on_backend(&config, Arc::clone(backend), scope.clone());
diff --git a/crates/openhuman-core/src/cron/scheduler_dispatch_tests.rs b/crates/openhuman-core/src/cron/scheduler_dispatch_tests.rs
index 604e53b6a9..8d5be7cc55 100644
--- a/crates/openhuman-core/src/cron/scheduler_dispatch_tests.rs
+++ b/crates/openhuman-core/src/cron/scheduler_dispatch_tests.rs
@@ -6,7 +6,6 @@ use super::*;
use crate::cron::system_job_handlers::{register, SystemJobContext};
use crate::cron::system_jobs::ensure_system_job;
use std::sync::atomic::{AtomicUsize, Ordering};
-use std::time::Duration;
use tempfile::TempDir;
use tinyflows_bus::schedule::types::Schedule;
use tinyflows_bus::schedule::JobPolicy;
diff --git a/crates/openhuman-core/src/flows/tinyflows/tinyflows_tests.rs b/crates/openhuman-core/src/flows/tinyflows/tinyflows_tests.rs
index 293720ee06..5c7ff03315 100644
--- a/crates/openhuman-core/src/flows/tinyflows/tinyflows_tests.rs
+++ b/crates/openhuman-core/src/flows/tinyflows/tinyflows_tests.rs
@@ -32,8 +32,6 @@ use crate::config::Config;
use crate::security::SecurityPolicy;
use super::build_capabilities;
-#[cfg(target_os = "linux")]
-use super::caps::OpenHumanCode;
use super::caps::{OpenHumanHttp, OpenHumanTools};
fn test_config(tmp: &TempDir) -> Arc<Config> {
diff --git a/crates/openhuman-core/src/modules/tinyflows.rs b/crates/openhuman-core/src/modules/tinyflows.rs
index fdafb4239f..83a344ad85 100644
--- a/crates/openhuman-core/src/modules/tinyflows.rs
+++ b/crates/openhuman-core/src/modules/tinyflows.rs
@@ -42,7 +42,7 @@ pub(crate) fn disabled_message() -> String {
#[cfg(feature = "modules")]
mod imp {
- use super::{disabled_message, HOST_BUS_NAME, MODULE_ID};
+ use super::{disabled_message, HOST_BUS_NAME};
use crate::config::Config;
#[cfg(not(test))]
use crate::modules::ops;
diff --git a/crates/openhuman-core/src/security/policy/command_checks.rs b/crates/openhuman-core/src/security/policy/command_checks.rs
index a34c7ab726..a17a2706c8 100644
--- a/crates/openhuman-core/src/security/policy/command_checks.rs
+++ b/crates/openhuman-core/src/security/policy/command_checks.rs
@@ -1,3 +1,7 @@
+// tinybox's shell helpers are deprecated in favour of tinysecurity-policy; the
+// test-only comparisons below keep using them until that move lands.
+#![allow(deprecated)]
+
use std::path::{Path, PathBuf};
#[cfg(test)]
diff --git a/crates/openhuman-core/src/storage/import/mod.rs b/crates/openhuman-core/src/storage/import/mod.rs
index b677bd50d6..7d60c5eb26 100644
--- a/crates/openhuman-core/src/storage/import/mod.rs
+++ b/crates/openhuman-core/src/storage/import/mod.rs
@@ -54,7 +54,7 @@ use tinystoragedrivers::{CollectionSpec, ErrorKind, Precondition};
use super::documents::Repo;
use super::rusqlite;
-use super::{block_on, Scope, StorageBackend};
+use super::{block_on, StorageBackend};
use crate::config::Config;
use rusqlite::Connection;
use serde_json::Value;
diff --git a/crates/openhuman-core/src/storage/import/snapshot.rs b/crates/openhuman-core/src/storage/import/snapshot.rs
index c90e7deb75..051abb2620 100644
--- a/crates/openhuman-core/src/storage/import/snapshot.rs
+++ b/crates/openhuman-core/src/storage/import/snapshot.rs
@@ -71,7 +71,7 @@ impl Snapshot {
///
/// When the copy cannot be opened with the SQLite driver or read.
pub fn driver_docs(&self, collections: fn() -> Vec<CollectionSpec>) -> Result<Vec<Record>> {
- use tinystoragedrivers::{DocumentStoreExt, Query, Scope, StorageBackend};
+ use tinystoragedrivers::{DocumentStoreExt, Query, StorageBackend};
let storage = tinystoragedrivers::sqlite::SqliteStorage::open(&self.db)
.with_context(|| format!("open the copy {}", self.db.display()))?;