Skip to content

Commit

Permalink
Reimplement get_cluster_info using driver instead of cqlsh
Browse files Browse the repository at this point in the history
On python 3.12.x cqlsh fails with:
```
libexec/python3.12.bin: symbol lookup error: /lib/x86_64-linux-gnu/libpthread.so.0: undefined symbol: __libc_pthread_init, version GLIBC_PRIVATE
```

So we need to work it around by not using cqlsh
  • Loading branch information
dkropachev committed Jan 5, 2025
1 parent d62eb38 commit cf2b115
Showing 1 changed file with 39 additions and 4 deletions.
43 changes: 39 additions & 4 deletions tests/integration/standard/test_scylla_cloud.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
import json
import logging
import os.path
from unittest import TestCase
from ccmlib.utils.ssl_utils import generate_ssl_stores
from ccmlib.utils.sni_proxy import refresh_certs, get_cluster_info, start_sni_proxy, create_cloud_config
from ccmlib.utils.sni_proxy import refresh_certs, start_sni_proxy, create_cloud_config, NodeInfo

from tests.integration import use_cluster
from cassandra.policies import TokenAwarePolicy, RoundRobinPolicy, ConstantReconnectionPolicy
from tests.integration import use_cluster, PROTOCOL_VERSION
from cassandra.cluster import Cluster, TwistedConnection


from cassandra.io.libevreactor import LibevConnection
supported_connection_classes = [LibevConnection, TwistedConnection]
supported_connection_classes = [TwistedConnection]

try:
from cassandra.io.libevreactor import LibevConnection
supported_connection_classes += [LibevConnection]
except ImportError:
pass


try:
from cassandra.io.asyncorereactor import AsyncoreConnection
supported_connection_classes += [AsyncoreConnection]
Expand All @@ -22,6 +31,32 @@

# need to run them with specific configuration like `gevent.monkey.patch_all()` or under async functions
# unsupported_connection_classes = [GeventConnection, AsyncioConnection, EventletConnection]
LOGGER = logging.getLogger(__name__)


def get_cluster_info(cluster, port=9142):
session = Cluster(
contact_points=list(map(lambda node: node.address(), cluster.nodelist())), protocol_version=PROTOCOL_VERSION,
load_balancing_policy=TokenAwarePolicy(RoundRobinPolicy()),
reconnection_policy=ConstantReconnectionPolicy(5)
).connect()

nodes_info = []

for row in session.execute('select host_id, broadcast_address, data_center from system.local'):
if row[0] and row[1]:
nodes_info.append(NodeInfo(address=row[1],
port=port,
host_id=row[0],
data_center=row[2]))

for row in session.execute('select host_id, broadcast_address, data_center from system.local'):
nodes_info.append(NodeInfo(address=row[1],
port=port,
host_id=row[0],
data_center=row[2]))

return nodes_info


class ScyllaCloudConfigTests(TestCase):
Expand Down

0 comments on commit cf2b115

Please sign in to comment.