Skip to content

Commit 4963764

Browse files
author
Roman
committed
single test + logging
1 parent 084536b commit 4963764

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

.github/workflows/e2e-subtensor-tests.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,10 @@ jobs:
3838
- name: Find test files
3939
id: get-tests
4040
run: |
41-
test_files=$(find tests/e2e_tests -name "test*.py" | jq -R -s -c 'split("\n") | map(select(. != ""))')
41+
# test_files=$(find tests/e2e_tests -name "test*.py" | jq -R -s -c 'split("\n") | map(select(. != ""))')
4242
# keep it here for future debug
4343
# test_files=$(find tests/e2e_tests -type f -name "test*.py" | grep -E 'test_(incentive|commit_weights|set_weights)\.py$' | jq -R -s -c 'split("\n") | map(select(. != ""))')
44+
test_files=$(find tests/e2e_tests -type f -name "test*.py" | grep -E 'test_staking.py$' | jq -R -s -c 'split("\n") | map(select(. != ""))')
4445
echo "test-files=$test_files" >> "$GITHUB_OUTPUT"
4546
shell: bash
4647

tests/e2e_tests/test_staking.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ def test_safe_staking_scenarios(subtensor, alice_wallet, bob_wallet):
354354
wait_for_inclusion=True,
355355
wait_for_finalization=True,
356356
safe_staking=True,
357-
rate_tolerance=0.005, # 0.5%
357+
rate_tolerance=0.001, # 0.5%
358358
allow_partial_stake=False,
359359
)
360360
assert success is False
@@ -375,7 +375,7 @@ def test_safe_staking_scenarios(subtensor, alice_wallet, bob_wallet):
375375
wait_for_inclusion=True,
376376
wait_for_finalization=True,
377377
safe_staking=True,
378-
rate_tolerance=0.005, # 0.5%
378+
rate_tolerance=0.001, # 0.5%
379379
allow_partial_stake=True,
380380
)
381381
assert success is True
@@ -424,13 +424,17 @@ def test_safe_staking_scenarios(subtensor, alice_wallet, bob_wallet):
424424
rate_tolerance=0.005, # 0.5%
425425
allow_partial_stake=False,
426426
)
427-
assert success is False
427+
assert success is False, "Unstake should fail."
428428

429429
current_stake = subtensor.get_stake(
430430
alice_wallet.coldkey.ss58_address,
431431
bob_wallet.hotkey.ss58_address,
432432
netuid=alice_subnet_netuid,
433433
)
434+
435+
logging.console.info(f"[orange]Current stake: {current_stake}[orange]")
436+
logging.console.info(f"[orange]Full stake: {full_stake}[orange]")
437+
434438
assert current_stake == full_stake, (
435439
"Stake should not change after failed unstake attempt"
436440
)
@@ -444,7 +448,7 @@ def test_safe_staking_scenarios(subtensor, alice_wallet, bob_wallet):
444448
wait_for_inclusion=True,
445449
wait_for_finalization=True,
446450
safe_staking=True,
447-
rate_tolerance=0.005, # 0.5%
451+
rate_tolerance=0.001, # 0.5%
448452
allow_partial_stake=True,
449453
)
450454
assert success is True
@@ -454,6 +458,7 @@ def test_safe_staking_scenarios(subtensor, alice_wallet, bob_wallet):
454458
bob_wallet.hotkey.ss58_address,
455459
netuid=alice_subnet_netuid,
456460
)
461+
logging.console.info(f"[orange]Partial unstake: {partial_unstake}[orange]")
457462
assert partial_unstake > Balance(0), "Some stake should remain"
458463

459464
# 3. Higher threshold - should succeed fully
@@ -468,7 +473,7 @@ def test_safe_staking_scenarios(subtensor, alice_wallet, bob_wallet):
468473
rate_tolerance=0.3, # 30%
469474
allow_partial_stake=False,
470475
)
471-
assert success is True
476+
assert success is True, "Unstake should succeed"
472477

473478

474479
def test_safe_swap_stake_scenarios(subtensor, alice_wallet, bob_wallet):

0 commit comments

Comments
 (0)