File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
modules/cassandra/testcontainers/cassandra Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -23,15 +23,16 @@ class CassandraContainer(DockerContainer):
23
23
.. doctest::
24
24
25
25
>>> from testcontainers.cassandra import CassandraContainer
26
- >>> from cassandra.cluster import Cluster
26
+ >>> from cassandra.cluster import Cluster, DCAwareRoundRobinPolicy
27
27
28
- >>> with CassandraContainer("cassandra:latest") as cassandra:
29
- ... cluster = Cluster(
30
- .... [cassandra.get_container_host_ip()],
31
- ... port=cassandra.get_exposed_port(cassandra.port)
32
- ... )
28
+ >>> with CassandraContainer("cassandra:4.1.4") as cassandra, Cluster(
29
+ ... cassandra.get_contact_points(),
30
+ ... load_balancing_policy=DCAwareRoundRobinPolicy(cassandra.get_local_datacenter()),
31
+ ... ) as cluster:
33
32
... session = cluster.connect()
34
33
... result = session.execute("SELECT release_version FROM system.local;")
34
+ ... result.one().release_version
35
+ '4.1.4'
35
36
"""
36
37
37
38
CQL_PORT = 9042
You can’t perform that action at this time.
0 commit comments