Fix leaky env variable causing flaky test (#3761)

This commit is contained in:
David Katz
2025-08-05 04:45:04 -04:00
committed by GitHub
parent 66f8ef123b
commit 97e508b3a1
+19 -10
View File
@@ -249,19 +249,28 @@ mod tests {
#[test]
#[serial]
fn test_model_config_context_limits() {
let config = ModelConfig::new("claude-3-opus")
.unwrap()
.with_context_limit(Some(150_000));
assert_eq!(config.context_limit(), 150_000);
// Clear all GOOSE environment variables to ensure clean test environment
with_var("GOOSE_TEMPERATURE", None::<&str>, || {
with_var("GOOSE_CONTEXT_LIMIT", None::<&str>, || {
with_var("GOOSE_TOOLSHIM", None::<&str>, || {
with_var("GOOSE_TOOLSHIM_OLLAMA_MODEL", None::<&str>, || {
let config = ModelConfig::new("claude-3-opus")
.unwrap()
.with_context_limit(Some(150_000));
assert_eq!(config.context_limit(), 150_000);
let config = ModelConfig::new("claude-3-opus").unwrap();
assert_eq!(config.context_limit(), 200_000);
let config = ModelConfig::new("claude-3-opus").unwrap();
assert_eq!(config.context_limit(), 200_000);
let config = ModelConfig::new("gpt-4-turbo").unwrap();
assert_eq!(config.context_limit(), 128_000);
let config = ModelConfig::new("gpt-4-turbo").unwrap();
assert_eq!(config.context_limit(), 128_000);
let config = ModelConfig::new("unknown-model").unwrap();
assert_eq!(config.context_limit(), DEFAULT_CONTEXT_LIMIT);
let config = ModelConfig::new("unknown-model").unwrap();
assert_eq!(config.context_limit(), DEFAULT_CONTEXT_LIMIT);
});
});
});
});
}
#[test]