From 5f367edb3cf4511794b64aed60a23c5d8b6b55e6 Mon Sep 17 00:00:00 2001 From: Nando Vieira Date: Fri, 15 Mar 2024 06:30:55 -0700 Subject: [PATCH] Do not raise error when trying to fund account on windows. (#1259) --- .github/workflows/rust.yml | 2 ++ cmd/crates/soroban-test/tests/it/config.rs | 34 +++++++++++++++++++++ cmd/soroban-cli/src/commands/network/mod.rs | 17 +++-------- 3 files changed, 41 insertions(+), 12 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index bd21e2a9c..543d7633c 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -52,6 +52,8 @@ jobs: - os: windows-latest-8-cores target: x86_64-pc-windows-msvc runs-on: ${{ matrix.os }} + env: + CI_TESTS: true steps: - uses: actions/checkout@v3 - uses: stellar/actions/rust-cache@main diff --git a/cmd/crates/soroban-test/tests/it/config.rs b/cmd/crates/soroban-test/tests/it/config.rs index b6f1bff08..bca7088ee 100644 --- a/cmd/crates/soroban-test/tests/it/config.rs +++ b/cmd/crates/soroban-test/tests/it/config.rs @@ -182,6 +182,40 @@ fn generate_key() { ); } +#[test] +fn generate_key_on_testnet() { + if std::env::var("CI_TEST").is_err() { + return; + } + let sandbox = TestEnv::default(); + sandbox + .new_assert_cmd("keys") + .arg("generate") + .arg("--rpc-url=https://soroban-testnet.stellar.org:443") + .arg("--network-passphrase=Test SDF Network ; September 2015") + .arg("test_2") + .assert() + .stdout("") + .stderr("") + .success(); + + sandbox + .new_assert_cmd("keys") + .arg("ls") + .assert() + .stdout(predicates::str::contains("test_2\n")); + println!( + "aa {}", + sandbox + .new_assert_cmd("keys") + .arg("address") + .arg("test_2") + .assert() + .success() + .stdout_as_str() + ); +} + #[test] fn seed_phrase() { let sandbox = TestEnv::default(); diff --git a/cmd/soroban-cli/src/commands/network/mod.rs b/cmd/soroban-cli/src/commands/network/mod.rs index f00d16f80..8e0059596 100644 --- a/cmd/soroban-cli/src/commands/network/mod.rs +++ b/cmd/soroban-cli/src/commands/network/mod.rs @@ -194,18 +194,11 @@ impl Network { let response = match uri.scheme_str() { Some("http") => hyper::Client::new().get(uri.clone()).await?, Some("https") => { - #[cfg(target_os = "windows")] - { - return Err(Error::WindowsNotSupported(uri.to_string())); - } - #[cfg(not(target_os = "windows"))] - { - let https = hyper_tls::HttpsConnector::new(); - hyper::Client::builder() - .build::<_, hyper::Body>(https) - .get(uri.clone()) - .await? - } + let https = hyper_tls::HttpsConnector::new(); + hyper::Client::builder() + .build::<_, hyper::Body>(https) + .get(uri.clone()) + .await? } _ => { return Err(Error::InvalidUrl(uri.to_string()));