fix(agent): accept legacy H2 offline packages
This commit is contained in:
2 files changed
+16
No files matched your search
@@ -46,6 +46,7 @@ const H2_PROFILES: &[AgentDriverProfile] = &[
|
||||
|
||||
const EXTRA_AGENT_LABELS: &[(&str, &str)] = &[
|
||||
("duckdb", "DuckDB"),
|
||||
("h2-legacy", "H2 2.1 Legacy"),
|
||||
("kafka", "Apache Kafka"),
|
||||
("rocketmq", "Apache RocketMQ"),
|
||||
("rabbitmq", "RabbitMQ"),
|
||||
@@ -432,6 +433,7 @@ mod tests {
|
||||
assert_eq!(agent_key(&DatabaseType::H2, Some("h2-v2")), Some("h2"));
|
||||
assert_eq!(agent_key(&DatabaseType::H2, Some("h2-v3")), Some("h2"));
|
||||
assert_eq!(agent_key(&DatabaseType::H2, Some("h2-custom")), Some("h2"));
|
||||
assert_eq!(label_for_key("h2-legacy"), Some("H2 2.1 Legacy"));
|
||||
assert!(!driver_store_entries().any(|(key, _)| key == "h2-legacy"));
|
||||
}
|
||||
|
||||
|
||||
@@ -814,6 +814,20 @@ fn offline_zip_import_rejects_unknown_driver_type() {
|
||||
assert!(err.contains("unknown driver type"));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn offline_zip_import_accepts_hidden_legacy_h2_driver() {
|
||||
let manager = test_manager("offline-h2-legacy-driver");
|
||||
let zip_path = test_path("offline-h2-legacy-driver").join("agents.zip");
|
||||
std::fs::create_dir_all(zip_path.parent().unwrap()).unwrap();
|
||||
write_offline_driver_zip_with_jar(&zip_path, "h2-legacy", "0.1.18", test_agent_jar_bytes());
|
||||
|
||||
let result = import_agents_from_zip(&manager, &zip_path, |_| {}).await.unwrap();
|
||||
|
||||
assert_eq!(result.drivers_installed, vec!["h2-legacy"]);
|
||||
assert!(manager.is_driver_installed("h2-legacy"));
|
||||
assert_eq!(manager.load_state().installed_drivers["h2-legacy"].version, "0.1.18");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn offline_zip_import_rejects_unsafe_entry_path() {
|
||||
let zip_path = test_path("offline-unsafe-entry").join("agents.zip");
|
||||
|
||||
Reference in new issue
Block a user