|
27 | 27 | from packaging.version import Version
|
28 | 28 |
|
29 | 29 | import cassandra
|
30 |
| -from cassandra.cluster import Cluster, Session, NoHostAvailable, ExecutionProfile, EXEC_PROFILE_DEFAULT |
| 30 | +from cassandra.cluster import Cluster, NoHostAvailable, ExecutionProfile, EXEC_PROFILE_DEFAULT |
31 | 31 | from cassandra.concurrent import execute_concurrent
|
32 | 32 | from cassandra.policies import (RoundRobinPolicy, ExponentialReconnectionPolicy,
|
33 | 33 | RetryPolicy, SimpleConvictionPolicy, HostDistance,
|
34 | 34 | AddressTranslator, TokenAwarePolicy, HostFilterPolicy)
|
35 | 35 | from cassandra import ConsistencyLevel
|
36 | 36 |
|
37 |
| -from cassandra.pool import Host |
38 | 37 | from cassandra.query import SimpleStatement, TraceUnavailable, tuple_factory
|
39 | 38 | from cassandra.auth import PlainTextAuthProvider, SaslAuthProvider
|
40 | 39 | from cassandra import connection
|
@@ -209,21 +208,21 @@ def cleanup():
|
209 | 208 | self.addCleanup(cleanup)
|
210 | 209 |
|
211 | 210 | # Test with empty list
|
212 |
| - self.cluster_to_shutdown = Cluster(protocol_version=PROTOCOL_VERSION) |
| 211 | + self.cluster_to_shutdown = Cluster([], protocol_version=PROTOCOL_VERSION) |
213 | 212 | with self.assertRaises(NoHostAvailable):
|
214 |
| - Session(self.cluster_to_shutdown, []) |
| 213 | + self.cluster_to_shutdown.connect() |
215 | 214 | self.cluster_to_shutdown.shutdown()
|
216 | 215 |
|
217 | 216 | # Test with only invalid
|
218 |
| - self.cluster_to_shutdown = Cluster(protocol_version=PROTOCOL_VERSION) |
| 217 | + self.cluster_to_shutdown = Cluster(('1.2.3.4',), protocol_version=PROTOCOL_VERSION) |
219 | 218 | with self.assertRaises(NoHostAvailable):
|
220 |
| - Session(self.cluster_to_shutdown, [Host("1.2.3.4", SimpleConvictionPolicy)]) |
| 219 | + self.cluster_to_shutdown.connect() |
221 | 220 | self.cluster_to_shutdown.shutdown()
|
222 | 221 |
|
223 | 222 | # Test with valid and invalid hosts
|
224 |
| - self.cluster_to_shutdown = Cluster(protocol_version=PROTOCOL_VERSION) |
225 |
| - Session(self.cluster_to_shutdown, [Host(x, SimpleConvictionPolicy) for x in |
226 |
| - ("127.0.0.1", "127.0.0.2", "1.2.3.4")]) |
| 223 | + self.cluster_to_shutdown = Cluster(("127.0.0.1", "127.0.0.2", "1.2.3.4"), |
| 224 | + protocol_version=PROTOCOL_VERSION) |
| 225 | + self.cluster_to_shutdown.connect() |
227 | 226 | self.cluster_to_shutdown.shutdown()
|
228 | 227 |
|
229 | 228 | def test_protocol_negotiation(self):
|
|
0 commit comments