diff --git a/rs/cli/src/clients.rs b/rs/cli/src/clients.rs index ab6e115e8..ff000225c 100644 --- a/rs/cli/src/clients.rs +++ b/rs/cli/src/clients.rs @@ -33,7 +33,7 @@ impl DashboardBackendClient { } } - pub fn new_with_network_url(url: String) -> Self { + pub fn new_with_backend_url(url: String) -> Self { Self { url: reqwest::Url::parse(&url).unwrap(), } diff --git a/rs/cli/src/main.rs b/rs/cli/src/main.rs index 83b79753c..9482abefa 100644 --- a/rs/cli/src/main.rs +++ b/rs/cli/src/main.rs @@ -78,13 +78,13 @@ async fn main() -> Result<(), anyhow::Error> { let runner_unauth = || async { let cli = cli::ParsedCli::from_opts(&cli_opts, false).await.expect("Failed to create unauthenticated CLI"); let ic_admin_wrapper = IcAdminWrapper::from_cli(cli); - runner::Runner::new_with_network_url(ic_admin_wrapper, backend_port).await.expect("Failed to create unauthenticated runner") + runner::Runner::new_with_network_and_backend_port(ic_admin_wrapper, &target_network, backend_port).await.expect("Failed to create unauthenticated runner") }; let runner_auth = || async { let cli = cli::ParsedCli::from_opts(&cli_opts, true).await.expect("Failed to create authenticated CLI"); let ic_admin_wrapper = IcAdminWrapper::from_cli(cli); - runner::Runner::new_with_network_url(ic_admin_wrapper, backend_port).await.expect("Failed to create authenticated runner") + runner::Runner::new_with_network_and_backend_port(ic_admin_wrapper, &target_network, backend_port).await.expect("Failed to create authenticated runner") }; match &cli_opts.subcommand { diff --git a/rs/cli/src/runner.rs b/rs/cli/src/runner.rs index eebb6d791..79a86728c 100644 --- a/rs/cli/src/runner.rs +++ b/rs/cli/src/runner.rs @@ -181,13 +181,14 @@ impl Runner { Ok(()) } - pub async fn new_with_network_url(ic_admin: ic_admin::IcAdminWrapper, backend_port: u16) -> anyhow::Result { + pub async fn new_with_network_and_backend_port( + ic_admin: ic_admin::IcAdminWrapper, + network: &Network, + backend_port: u16, + ) -> anyhow::Result { let backend_url = format!("http://localhost:{}/", backend_port); - let network = Network::new("localhost", &vec![backend_url.parse()?]) - .await - .map_err(|e| anyhow::format_err!("{}", e))?; - let dashboard_backend_client = DashboardBackendClient::new_with_network_url(backend_url); + let dashboard_backend_client = DashboardBackendClient::new_with_backend_url(backend_url); Ok(Self { ic_admin, dashboard_backend_client, @@ -201,7 +202,7 @@ impl Runner { // TODO: Remove once DREL-118 completed. let backend_port = local_unused_port(); let backend_url = format!("http://localhost:{}/", backend_port); - let dashboard_backend_client = DashboardBackendClient::new_with_network_url(backend_url); + let dashboard_backend_client = DashboardBackendClient::new_with_backend_url(backend_url); let mut registry = registry::RegistryState::new(network, true).await; let node_providers = query_ic_dashboard_list::("v3/node-providers")