fix: stop fleet tests when RLN registration fails

This commit is contained in:
Roman 2026-04-23 16:20:19 +08:00
parent 0442ef4fd3
commit 5901a6f848
No known key found for this signature in database
GPG Key ID: 583BDF43C238B83E
2 changed files with 23 additions and 5 deletions

View File

@ -10,7 +10,7 @@ import pytest
import requests
from src.libs.common import delay
from src.libs.custom_logger import get_custom_logger
from tenacity import retry, stop_after_delay, wait_fixed, sleep
from tenacity import retry, stop_after_attempt, stop_after_delay, wait_fixed, sleep
from docker.errors import NotFound as DockerNotFound
from src.node.api_clients.rest import REST
from src.node.docker_mananger import DockerManager
@ -280,7 +280,7 @@ class WakuNode:
},
}
@retry(stop=stop_after_delay(250), wait=wait_fixed(0.1), reraise=True)
@retry(stop=stop_after_attempt(1), wait=wait_fixed(0.1), reraise=True)
def register_rln(self, **kwargs):
logger.debug("Registering RLN credentials...")
self._docker_manager.create_network()

View File

@ -135,9 +135,9 @@ def fleet_rln_state(request):
state["rln_membership_indexes"],
state["keystore_prefixes"],
)
except Exception as ex:
logger.warning("Fleet RLN: registration failed nodes will start without RLN: %s", ex)
state = {"keystore_prefixes": [], "rln_membership_indexes": []}
except BaseException as ex:
logger.error("Fleet RLN: registration failed aborting test session: %s", ex)
pytest.exit(f"Fleet RLN registration failed aborting session: {ex}", returncode=1)
yield state
@ -267,6 +267,24 @@ def patch_waku_node_start(request, monkeypatch, fleet_rln_state):
yield
@pytest.fixture(scope="function", autouse=True)
def skip_fleet_test_without_rln(request, fleet_rln_state):
"""Skip tests marked @pytest.mark.waku_test_fleet when no RLN keystore is
available for the current session.
When fleet bootstrap is active but RLN credentials were not set (or
on-chain registration failed), local nodes cannot join the fleet relay mesh
(which enforces RLN), so every fleet-marked test would ERROR instead of
giving useful signal. An explicit skip with a clear reason is cleaner.
"""
if not _fleet_bootstrap_enabled(request.config):
return
if not request.node.get_closest_marker("waku_test_fleet"):
return
if not fleet_rln_state.get("keystore_prefixes"):
pytest.skip("Skipping fleet test: RLN keystore not available " "(RLN_CREDENTIALS not set or on-chain registration failed)")
@pytest.fixture(autouse=True)
def patch_fleet_cluster_config(request, monkeypatch):
"""When --fleet is active, override every step-class pubsub-topic attribute and