Skip to content

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

test(inference): add test for custom primary cloud selection

Steven Enamakel373d06404454
diff --git a/crates/openhuman-tinyhumans/src/inference/tiers_tests.rs b/crates/openhuman-tinyhumans/src/inference/tiers_tests.rs
index f020dc2969..d9d7d93f81 100644
--- a/crates/openhuman-tinyhumans/src/inference/tiers_tests.rs
+++ b/crates/openhuman-tinyhumans/src/inference/tiers_tests.rs
@@ -143,6 +143,28 @@ fn hosted_normalizer_selects_existing_managed_entry_for_legacy_managed_endpoint(
assert_eq!(config.primary_cloud.as_deref(), Some(managed_id.as_str()));
}
+#[test]
+fn hosted_normalizer_leaves_custom_and_explicit_primary_choices_alone() {
+ let mut custom = Config::default();
+ custom.primary_cloud = None;
+ custom.inference_url = Some("https://custom.example/v1".into());
+ custom.cloud_providers.push(
+ openhuman_embed::__host::config::schema::cloud_providers::CloudProviderCreds {
+ id: "p_hosted".into(),
+ slug: "openhuman".into(),
+ endpoint: "https://api.managed.test/v1".into(),
+ ..Default::default()
+ },
+ );
+ assert!(!normalize_with_hosted_registration(&mut custom));
+ assert_eq!(custom.primary_cloud, None);
+
+ let mut selected = custom.clone();
+ selected.primary_cloud = Some("p_custom".into());
+ assert!(!normalize_with_hosted_registration(&mut selected));
+ assert_eq!(selected.primary_cloud.as_deref(), Some("p_custom"));
+}
+
#[test]
fn managed_tier_vocabulary_maps_aliases_and_leaves_concrete_ids_raw() {
for (model, role) in [