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 legacy managed endpoint selection

Steven Enamakel5e6d5b4c7083
diff --git a/crates/openhuman-tinyhumans/src/inference/tiers_tests.rs b/crates/openhuman-tinyhumans/src/inference/tiers_tests.rs
index c3511f0593..3667344227 100644
--- a/crates/openhuman-tinyhumans/src/inference/tiers_tests.rs
+++ b/crates/openhuman-tinyhumans/src/inference/tiers_tests.rs
@@ -121,6 +121,28 @@ fn hosted_normalizer_seeds_its_preset_using_the_configured_api_url_once() {
assert_eq!(config.cloud_providers[0].id, id);
}
+#[test]
+fn hosted_normalizer_selects_existing_managed_entry_for_legacy_managed_endpoint() {
+ let mut config = Config::default();
+ config.primary_cloud = None;
+ config.inference_url = Some("https://api.managed.test/v1".into());
+ config.resolved_endpoints.managed_hosts = vec![".managed.test".into()];
+ let managed_id = "p_existing_openhuman".to_string();
+ config.cloud_providers.push(
+ openhuman_embed::__host::config::schema::cloud_providers::CloudProviderCreds {
+ id: managed_id.clone(),
+ slug: "openhuman".into(),
+ endpoint: "https://api.managed.test/v1".into(),
+ ..Default::default()
+ },
+ );
+
+ assert!(normalize_with_hosted_registration(&mut config));
+ assert_eq!(config.primary_cloud.as_deref(), Some(managed_id.as_str()));
+ assert!(!normalize_with_hosted_registration(&mut config));
+ assert_eq!(config.primary_cloud.as_deref(), Some(managed_id.as_str()));
+}
+
#[test]
fn managed_tier_vocabulary_maps_aliases_and_leaves_concrete_ids_raw() {
for (model, role) in [