From 99842856f437efe1f54c1e267c7f9ebaca07e568 Mon Sep 17 00:00:00 2001 From: Adrian Cole <64215+codefromthecrypt@users.noreply.github.com> Date: Fri, 6 Feb 2026 22:26:11 +0800 Subject: [PATCH] test(providers): add model listing to live provider suite (#7038) Signed-off-by: Adrian Cole --- crates/goose/tests/providers.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/crates/goose/tests/providers.rs b/crates/goose/tests/providers.rs index 4c116a31..46a66795 100644 --- a/crates/goose/tests/providers.rs +++ b/crates/goose/tests/providers.rs @@ -367,7 +367,31 @@ impl ProviderTester { Ok(()) } + async fn test_model_listing(&self) -> Result<()> { + let models = self.provider.fetch_supported_models().await?; + + println!("=== {}::model_listing ===", self.name); + dbg!(&models); + println!("==================="); + + if let Some(models) = models { + assert!(!models.is_empty(), "Expected non-empty model list"); + let model_name = &self.provider.get_model_config().model_name; + // Some providers (e.g. Ollama) return names with tags like "qwen3:latest" + // while the configured model name may be just "qwen3". + assert!( + models + .iter() + .any(|m| m == model_name || m.starts_with(&format!("{}:", model_name))), + "Expected model '{}' in supported models", + model_name + ); + } + Ok(()) + } + async fn run_test_suite(&self) -> Result<()> { + self.test_model_listing().await?; self.test_basic_response().await?; self.test_tool_usage().await?; self.test_context_length_exceeded_error().await?;