Skip to content

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

refactor(inference): move cloud tests to separate module

Steven Enamakel5561a5506ebb
diff --git a/crates/openhuman-core/src/inference/provider/factory_crate_native_cloud_tests.rs b/crates/openhuman-core/src/inference/provider/factory_crate_native_cloud_tests.rs
new file mode 100644
index 0000000000..9f9442fed1
--- /dev/null
+++ b/crates/openhuman-core/src/inference/provider/factory_crate_native_cloud_tests.rs
@@ -0,0 +1,36 @@
+use super::*;
+
+#[test]
+fn try_create_cloud_slug_flips_openai_but_declines_non_cloud() {
+ let _guard = crate::inference::inference_test_guard();
+ // `openai` (API-key Bearer, no codex OAuth) now flips crate-native on Chat
+ // Completions — the legacy `/v1/responses` fallback is not replicated.
+ let (_tmp, mut openai) = isolated_config();
+ openai.cloud_providers.push(openai_entry("p_oai", "openai"));
+ openai.chat_provider = Some("openai:gpt-4o-mini".to_string());
+ store_fixture_cloud_key(&openai, "openai");
+ let (model, model_id) =
+ try_create_cloud_slug_chat_model("chat", &openai, &EgressLedger::none())
+ .expect("openai should flip crate-native")
+ .expect("build");
+ assert_eq!(model_id, "gpt-4o-mini");
+ assert_eq!(
+ model.profile().and_then(|p| p.provider.as_deref()),
+ Some("openai")
+ );
+
+ // Managed (default), local runtimes, and unconfigured slugs are not cloud
+ // slugs — they decline and fall through to their own paths.
+ assert!(
+ try_create_cloud_slug_chat_model("chat", &Config::default(), &EgressLedger::none())
+ .is_none()
+ );
+ let mut local = Config::default();
+ local.chat_provider = Some("ollama:qwen2.5".to_string());
+ assert!(try_create_cloud_slug_chat_model("chat", &local, &EgressLedger::none()).is_none());
+ let mut unconfigured = Config::default();
+ unconfigured.chat_provider = Some("deepseek:deepseek-chat".to_string());
+ assert!(
+ try_create_cloud_slug_chat_model("chat", &unconfigured, &EgressLedger::none()).is_none()
+ );
+}
diff --git a/crates/openhuman-core/src/inference/provider/factory_crate_native_tests.rs b/crates/openhuman-core/src/inference/provider/factory_crate_native_tests.rs
index 90a9cbb6eb..eec15d739b 100644
--- a/crates/openhuman-core/src/inference/provider/factory_crate_native_tests.rs
+++ b/crates/openhuman-core/src/inference/provider/factory_crate_native_tests.rs
@@ -721,37 +721,5 @@ fn openhuman_jwt_slug_without_model_preserves_managed_role_tier() {
);
}
-#[test]
-fn try_create_cloud_slug_flips_openai_but_declines_non_cloud() {
- let _guard = crate::inference::inference_test_guard();
- // `openai` (API-key Bearer, no codex OAuth) now flips crate-native on Chat
- // Completions — the legacy `/v1/responses` fallback is not replicated.
- let (_tmp, mut openai) = isolated_config();
- openai.cloud_providers.push(openai_entry("p_oai", "openai"));
- openai.chat_provider = Some("openai:gpt-4o-mini".to_string());
- store_fixture_cloud_key(&openai, "openai");
- let (model, model_id) =
- try_create_cloud_slug_chat_model("chat", &openai, &EgressLedger::none())
- .expect("openai should flip crate-native")
- .expect("build");
- assert_eq!(model_id, "gpt-4o-mini");
- assert_eq!(
- model.profile().and_then(|p| p.provider.as_deref()),
- Some("openai")
- );
-
- // Managed (default), local runtimes, and unconfigured slugs are not cloud
- // slugs — they decline and fall through to their own paths.
- assert!(
- try_create_cloud_slug_chat_model("chat", &Config::default(), &EgressLedger::none())
- .is_none()
- );
- let mut local = Config::default();
- local.chat_provider = Some("ollama:qwen2.5".to_string());
- assert!(try_create_cloud_slug_chat_model("chat", &local, &EgressLedger::none()).is_none());
- let mut unconfigured = Config::default();
- unconfigured.chat_provider = Some("deepseek:deepseek-chat".to_string());
- assert!(
- try_create_cloud_slug_chat_model("chat", &unconfigured, &EgressLedger::none()).is_none()
- );
-}
+#[path = "factory_crate_native_cloud_tests.rs"]
+mod cloud_tests;