From 55aec553660ec199d08985f6cebcda8b23a2c79c Mon Sep 17 00:00:00 2001 From: Willem Wyndham Date: Thu, 14 Mar 2024 14:09:42 -0400 Subject: [PATCH] fix: add CI test that funds accounts on testnet --- .github/workflows/rust.yml | 2 ++ cmd/crates/soroban-test/tests/it/config.rs | 34 ++++++++++++++++++++++ 2 files changed, 36 insertions(+) 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();