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):
2323 .. doctest::
2424
2525 >>> from testcontainers.cassandra import CassandraContainer
26- >>> from cassandra.cluster import Cluster
26+ >>> from cassandra.cluster import Cluster, DCAwareRoundRobinPolicy
2727
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:
3332 ... session = cluster.connect()
3433 ... result = session.execute("SELECT release_version FROM system.local;")
34+ ... result.one().release_version
35+ '4.1.4'
3536 """
3637
3738 CQL_PORT = 9042
You can’t perform that action at this time.
0 commit comments