diff --git a/tests/api2/test_alert.py b/tests/api2/test_alert.py index aea15b431ec57..afa25406d56fa 100644 --- a/tests/api2/test_alert.py +++ b/tests/api2/test_alert.py @@ -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" ): @@ -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): @@ -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)