Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,10 @@ impl Config {

Some(Cluster {
nodes: filtered_nodes,
defaults: ClusterDefaults::default(),
defaults: ClusterDefaults {
ssh_key: Some("/home/config/ssh/id_cluster".to_string()),
..ClusterDefaults::default()
},
interactive: None,
})
}
Expand Down
14 changes: 14 additions & 0 deletions tests/backendai_env_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ async fn test_backendai_env_auto_detection() {
// Get the bai_auto cluster
let cluster = config.clusters.get("bai_auto").unwrap();

// Verify SSH key is set to Backend.AI cluster key
assert_eq!(
cluster.defaults.ssh_key,
Some("/home/config/ssh/id_cluster".to_string()),
"Backend.AI cluster should use /home/config/ssh/id_cluster as SSH key"
);

// Verify nodes were parsed correctly
assert_eq!(cluster.nodes.len(), 3);

Expand All @@ -66,6 +73,13 @@ async fn test_backendai_env_auto_detection() {
assert_eq!(nodes[1].host, "node2.ai");
assert_eq!(nodes[2].host, "node3.ai");

// Verify get_ssh_key returns the correct key for Backend.AI cluster
assert_eq!(
config.get_ssh_key(Some("bai_auto")),
Some("/home/config/ssh/id_cluster".to_string()),
"get_ssh_key should return Backend.AI cluster key path"
);

// Restore original env vars
unsafe {
if let Some(val) = orig_hosts {
Expand Down