Skip to content

Commit

Permalink
fix indexing issues
Browse files Browse the repository at this point in the history
  • Loading branch information
creatorcary committed Sep 6, 2024
1 parent 4212168 commit 898e4ca
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions tests/api2/test_alert.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ def degraded_pool_gptid():
def alert_id(degraded_pool_gptid):
call("alert.process_alerts")
while True:
for alert in call("alert.run_source", "VolumeStatus"):
for alert in call("alert.list"):
if (
alert["source"] == "VolumeStatus" and
alert["args"]["volume"] == pool_name and
alert["args"]["state"] == "DEGRADED"
):
Expand All @@ -36,8 +37,9 @@ def alert_id(degraded_pool_gptid):


def test_verify_the_pool_is_degraded(degraded_pool_gptid):
status = call("zpool.status", {"name": pool_name})[pool_name][ID_PATH + degraded_pool_gptid]["disk_status"]
assert status == "DEGRADED"
status = call("zpool.status", {"name": pool_name})
disk_status = status[pool_name]["data"][ID_PATH + degraded_pool_gptid]["disk_status"]
assert disk_status == "DEGRADED"


def test_dismiss_alert(alert_id):
Expand All @@ -54,8 +56,9 @@ def test_restore_alert(alert_id):

def test_clear_the_pool_degradation(degraded_pool_gptid):
ssh(f"zpool clear {pool_name}")
status = call("zpool.status", {"name": pool_name})[pool_name][ID_PATH + degraded_pool_gptid]["disk_status"]
assert status != "DEGRADED"
status = call("zpool.status", {"name": pool_name})
disk_status = status[pool_name]["data"][ID_PATH + degraded_pool_gptid]["disk_status"]
assert disk_status != "DEGRADED"


@pytest.mark.timeout(120)
Expand Down

0 comments on commit 898e4ca

Please sign in to comment.