From 2ffe263b3ce7c8e8dbed112bd3b8e3d4f4930bad Mon Sep 17 00:00:00 2001 From: Christopher Gerber Date: Tue, 21 Jan 2025 22:22:51 -0800 Subject: [PATCH 1/3] first pass stabalizing e2e test workflow --- .github/workflows/e2e_tests.yml | 1 + tests/test_e2e.py | 6 +----- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/e2e_tests.yml b/.github/workflows/e2e_tests.yml index b8f8ce5..37ba4cd 100644 --- a/.github/workflows/e2e_tests.yml +++ b/.github/workflows/e2e_tests.yml @@ -6,6 +6,7 @@ jobs: test: runs-on: ubuntu-latest strategy: + max-parallel: 1 matrix: python: ["3.10", "3.11", "3.12"] diff --git a/tests/test_e2e.py b/tests/test_e2e.py index a010960..1d61d54 100644 --- a/tests/test_e2e.py +++ b/tests/test_e2e.py @@ -82,12 +82,8 @@ def test_wallet_transfer(imported_wallet): transfer = imported_wallet.transfer( amount=Decimal("0.000000001"), asset_id="eth", destination=destination_wallet - ) - - transfer.wait() - time.sleep(2) + ).wait() - assert transfer is not None assert transfer.status.value == "complete" final_source_balance = Decimal(str(imported_wallet.balances().get("eth", 0))) From d4f0f3fb6b93f69f2f21f326d20b48b8a9362aa2 Mon Sep 17 00:00:00 2001 From: Christopher Gerber Date: Wed, 22 Jan 2025 12:48:48 -0800 Subject: [PATCH 2/3] feedback --- .github/workflows/e2e_tests.yml | 2 +- tests/test_e2e.py | 32 ++++++++++++++++++-------------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/.github/workflows/e2e_tests.yml b/.github/workflows/e2e_tests.yml index 37ba4cd..f365278 100644 --- a/.github/workflows/e2e_tests.yml +++ b/.github/workflows/e2e_tests.yml @@ -8,7 +8,7 @@ jobs: strategy: max-parallel: 1 matrix: - python: ["3.10", "3.11", "3.12"] + python: ["3.10"] steps: - uses: actions/checkout@v3 diff --git a/tests/test_e2e.py b/tests/test_e2e.py index 1d61d54..3d53efb 100644 --- a/tests/test_e2e.py +++ b/tests/test_e2e.py @@ -70,15 +70,17 @@ def test_wallet_import(wallet_data): @pytest.mark.e2e def test_wallet_transfer(imported_wallet): """Test wallet transfer.""" - try: - imported_wallet.faucet().wait() - except FaucetLimitReachedError: - print("Faucet limit reached, continuing...") destination_wallet = Wallet.create() - initial_source_balance = Decimal(str(imported_wallet.balances().get("eth", 0))) - initial_dest_balance = Decimal(str(destination_wallet.balances().get("eth", 0))) + initial_source_balance = imported_wallet.balance("eth") + initial_dest_balance = destination_wallet.balance("eth") + + if initial_source_balance < 0.000000001: + try: + imported_wallet.faucet().wait() + except FaucetLimitReachedError: + print("Faucet limit reached, continuing...") transfer = imported_wallet.transfer( amount=Decimal("0.000000001"), asset_id="eth", destination=destination_wallet @@ -86,8 +88,8 @@ def test_wallet_transfer(imported_wallet): assert transfer.status.value == "complete" - final_source_balance = Decimal(str(imported_wallet.balances().get("eth", 0))) - final_dest_balance = Decimal(str(destination_wallet.balances().get("eth", 0))) + final_source_balance = imported_wallet.balance("eth") + final_dest_balance = destination_wallet.balance("eth") assert final_source_balance < initial_source_balance assert final_dest_balance > initial_dest_balance @@ -96,15 +98,17 @@ def test_wallet_transfer(imported_wallet): @pytest.mark.e2e def test_transaction_history(imported_wallet): """Test transaction history retrieval.""" - try: - imported_wallet.faucet().wait() - except FaucetLimitReachedError: - print("Faucet limit reached, continuing...") - destination_wallet = Wallet.create() + initial_source_balance = imported_wallet.balance("eth") + if initial_source_balance < 0.000000001: + try: + imported_wallet.faucet().wait() + except FaucetLimitReachedError: + print("Faucet limit reached, continuing...") + transfer = imported_wallet.transfer( - amount=Decimal("0.0001"), asset_id="eth", destination=destination_wallet + amount=Decimal("0.000000001"), asset_id="eth", destination=destination_wallet ).wait() time.sleep(10) From 8bf7aa5dd5fe33977a0fd12e11b925ec176217ee Mon Sep 17 00:00:00 2001 From: Christopher Gerber Date: Wed, 22 Jan 2025 13:01:48 -0800 Subject: [PATCH 3/3] linting --- tests/test_e2e.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_e2e.py b/tests/test_e2e.py index 3d53efb..6028c6e 100644 --- a/tests/test_e2e.py +++ b/tests/test_e2e.py @@ -70,7 +70,6 @@ def test_wallet_import(wallet_data): @pytest.mark.e2e def test_wallet_transfer(imported_wallet): """Test wallet transfer.""" - destination_wallet = Wallet.create() initial_source_balance = imported_wallet.balance("eth")