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 module for tier configuration

Steven Enamakel0aed29497370
diff --git a/crates/openhuman-tinyhumans/src/inference/tiers.rs b/crates/openhuman-tinyhumans/src/inference/tiers.rs
index 772bb55b08..17fec82205 100644
--- a/crates/openhuman-tinyhumans/src/inference/tiers.rs
+++ b/crates/openhuman-tinyhumans/src/inference/tiers.rs
@@ -150,3 +150,7 @@ pub(crate) fn normalize_config(config: &mut Config) -> bool {
}
changed
}
+
+#[cfg(test)]
+#[path = "tiers_tests.rs"]
+mod tests;
diff --git a/crates/openhuman-tinyhumans/src/inference/tiers_tests.rs b/crates/openhuman-tinyhumans/src/inference/tiers_tests.rs
new file mode 100644
index 0000000000..fdf9015e44
--- /dev/null
+++ b/crates/openhuman-tinyhumans/src/inference/tiers_tests.rs
@@ -0,0 +1,24 @@
+use super::*;
+
+#[test]
+fn hosted_normalizer_rewrites_legacy_tiers_and_preserves_concrete_pins() {
+ let mut config = Config::default();
+ config.default_model = Some("reasoning-v1".to_string());
+ config.orchestrator.model = Some("custom/orchestrator-model".to_string());
+ config.agents.insert(
+ "pinned".to_string(),
+ crate::agent::AgentConfig {
+ model: "vendor/model-id".to_string(),
+ ..Default::default()
+ },
+ );
+
+ assert!(normalize_config(&mut config));
+ assert_eq!(config.default_model.as_deref(), Some(MODEL_MANAGED_DEFAULT));
+ assert_eq!(
+ config.orchestrator.model.as_deref(),
+ Some("custom/orchestrator-model")
+ );
+ assert_eq!(config.agents["pinned"].model, "vendor/model-id");
+ assert!(!normalize_config(&mut config));
+}