diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index f218e4a9..df15684b 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -79,7 +79,11 @@ jobs: pip install "libvalkey>=4.0.0" fi invoke devenv - sleep 10 # time to settle + if [[ "${{matrix.test-type}}" == "standalone" ]]; then + ./util/wait-for-it.sh localhost:6379 + else + ./util/wait-for-it.sh localhost:16379 + fi invoke ${{matrix.test-type}}-tests --protocol=${{ matrix.protocol-version }} if [[ "${{matrix.python-version}}" != pypy-* ]]; then invoke ${{matrix.test-type}}-tests --uvloop --protocol=${{ matrix.protocol-version }} diff --git a/valkey/cluster.py b/valkey/cluster.py index 453482b8..bb62f3c7 100644 --- a/valkey/cluster.py +++ b/valkey/cluster.py @@ -1648,7 +1648,10 @@ def initialize(self): self.nodes_cache = tmp_nodes_cache self.slots_cache = tmp_slots # Set the default node - self.default_node = self.get_nodes_by_server_type(PRIMARY)[0] + try: + self.default_node = self.get_nodes_by_server_type(PRIMARY)[0] + except IndexError: + raise ValkeyClusterException("No primary nodes found in the cluster") if self._dynamic_startup_nodes: # Populate the startup nodes with all discovered nodes self.startup_nodes = tmp_nodes_cache