Skip to content

Commit 8974779

Browse files
committed
fix(tests/integration/__init__.py): Rename "TestCluster" to "IntegrationTestCluster"
1 parent 5762a3d commit 8974779

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+287
-287
lines changed

Diff for: tests/integration/__init__.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def get_server_versions():
7575
if cass_version is not None:
7676
return (cass_version, cql_version)
7777

78-
c = TestCluster()
78+
c = IntegrationTestCluster()
7979
s = c.connect()
8080
row = s.execute('SELECT cql_version, release_version FROM system.local')[0]
8181

@@ -706,9 +706,9 @@ def setup_keyspace(ipformat=None, wait=True, protocol_version=None):
706706
_protocol_version = PROTOCOL_VERSION
707707

708708
if not ipformat:
709-
cluster = TestCluster(protocol_version=_protocol_version)
709+
cluster = IntegrationTestCluster(protocol_version=_protocol_version)
710710
else:
711-
cluster = TestCluster(contact_points=["::1"], protocol_version=_protocol_version)
711+
cluster = IntegrationTestCluster(contact_points=["::1"], protocol_version=_protocol_version)
712712
session = cluster.connect()
713713

714714
try:
@@ -802,7 +802,7 @@ def create_keyspace(cls, rf):
802802

803803
@classmethod
804804
def common_setup(cls, rf, keyspace_creation=True, create_class_table=False, **cluster_kwargs):
805-
cls.cluster = TestCluster(**cluster_kwargs)
805+
cls.cluster = IntegrationTestCluster(**cluster_kwargs)
806806
cls.session = cls.cluster.connect(wait_for_all_pools=True)
807807
cls.ks_name = cls.__name__.lower()
808808
if keyspace_creation:
@@ -990,7 +990,7 @@ def assert_startswith(s, prefix):
990990
)
991991

992992

993-
class TestCluster(object):
993+
class IntegrationTestCluster(object):
994994
DEFAULT_PROTOCOL_VERSION = default_protocol_version
995995
DEFAULT_CASSANDRA_IP = CASSANDRA_IP
996996
DEFAULT_ALLOW_BETA = ALLOW_BETA_PROTOCOL

Diff for: tests/integration/advanced/__init__.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from ccmlib import common
2727

2828
from tests.integration import get_server_versions, BasicKeyspaceUnitTestCase, \
29-
drop_keyspace_shutdown_cluster, get_node, USE_CASS_EXTERNAL, TestCluster
29+
drop_keyspace_shutdown_cluster, get_node, USE_CASS_EXTERNAL, IntegrationTestCluster
3030
from tests.integration import use_singledc, use_single_node, wait_for_node_socket, CASSANDRA_IP
3131

3232
home = expanduser('~')
@@ -106,7 +106,7 @@ def use_cluster_with_graph(num_nodes):
106106
# Wait for spark master to start up
107107
spark_master_http = ("localhost", 7080)
108108
common.check_socket_listening(spark_master_http, timeout=60)
109-
tmp_cluster = TestCluster()
109+
tmp_cluster = IntegrationTestCluster()
110110

111111
# Start up remaining nodes.
112112
try:
@@ -134,7 +134,7 @@ class BasicGeometricUnitTestCase(BasicKeyspaceUnitTestCase):
134134

135135
@classmethod
136136
def common_dse_setup(cls, rf, keyspace_creation=True):
137-
cls.cluster = TestCluster()
137+
cls.cluster = IntegrationTestCluster()
138138
cls.session = cls.cluster.connect()
139139
cls.ks_name = cls.__name__.lower()
140140
if keyspace_creation:

Diff for: tests/integration/advanced/graph/__init__.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def session_setup(self):
160160
)
161161
)
162162

163-
self.cluster = TestCluster(execution_profiles={
163+
self.cluster = IntegrationTestCluster(execution_profiles={
164164
EXEC_PROFILE_GRAPH_DEFAULT: ep_graphson1,
165165
EXEC_PROFILE_GRAPH_ANALYTICS_DEFAULT: ep_analytics,
166166
"graphson1": ep_graphson1,
@@ -275,7 +275,7 @@ def session_setup(self):
275275
)
276276
)
277277

278-
self.cluster = TestCluster(execution_profiles={
278+
self.cluster = IntegrationTestCluster(execution_profiles={
279279
EXEC_PROFILE_GRAPH_DEFAULT: ep_graphson1,
280280
EXEC_PROFILE_GRAPH_ANALYTICS_DEFAULT: ep_analytics,
281281
"graphson1": ep_graphson1,
@@ -360,7 +360,7 @@ class BasicSharedGraphUnitTestCase(BasicKeyspaceUnitTestCase):
360360

361361
@classmethod
362362
def session_setup(cls):
363-
cls.cluster = TestCluster()
363+
cls.cluster = IntegrationTestCluster()
364364
cls.session = cls.cluster.connect()
365365
cls.ks_name = cls.__name__.lower()
366366
cls.cass_version, cls.cql_version = get_server_versions()

Diff for: tests/integration/advanced/graph/test_graph.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
from cassandra.util import SortedSet
2626

2727
from tests.integration import DSE_VERSION, greaterthanorequaldse51, greaterthanorequaldse68, \
28-
requiredse, TestCluster
28+
requiredse, IntegrationTestCluster
2929
from tests.integration.advanced.graph import BasicGraphUnitTestCase, GraphUnitTestCase, \
3030
GraphProtocol, ClassicGraphSchema, CoreGraphSchema, use_single_node_with_graph
3131

@@ -150,7 +150,7 @@ def test_graph_profile(self):
150150
exec_short_timeout.graph_options.graph_name = self.graph_name
151151

152152
# Add a single execution policy on cluster creation
153-
local_cluster = TestCluster(execution_profiles={"exec_dif_factory": exec_dif_factory})
153+
local_cluster = IntegrationTestCluster(execution_profiles={"exec_dif_factory": exec_dif_factory})
154154
local_session = local_cluster.connect()
155155
self.addCleanup(local_cluster.shutdown)
156156

Diff for: tests/integration/advanced/test_adv_metadata.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
BasicSharedKeyspaceUnitTestCaseRF1,
1919
greaterthanorequaldse51, greaterthanorequaldse60,
2020
greaterthanorequaldse68, use_single_node,
21-
DSE_VERSION, requiredse, TestCluster)
21+
DSE_VERSION, requiredse, IntegrationTestCluster)
2222

2323
try:
2424
import unittest2 as unittest
@@ -392,4 +392,4 @@ def test_connection_on_graph_schema_error(self):
392392
""" % (self.ks_name,))
393393

394394
self.session.execute('TRUNCATE system_schema.vertices')
395-
TestCluster().connect().shutdown()
395+
IntegrationTestCluster().connect().shutdown()

Diff for: tests/integration/advanced/test_auth.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
from cassandra.protocol import Unauthorized
3131
from cassandra.query import SimpleStatement
3232
from tests.integration import (get_cluster, greaterthanorequaldse51,
33-
remove_cluster, requiredse, DSE_VERSION, TestCluster)
33+
remove_cluster, requiredse, DSE_VERSION, IntegrationTestCluster)
3434
from tests.integration.advanced import ADS_HOME, use_single_node_with_graph
3535
from tests.integration.advanced.graph import reset_graph, ClassicGraphFixtures
3636

@@ -158,7 +158,7 @@ def connect_and_query(self, auth_provider, query=None):
158158
Runs a simple system query with the auth_provided specified.
159159
"""
160160
os.environ['KRB5_CONFIG'] = self.krb_conf
161-
self.cluster = TestCluster(auth_provider=auth_provider)
161+
self.cluster = IntegrationTestCluster(auth_provider=auth_provider)
162162
self.session = self.cluster.connect()
163163
query = query if query else "SELECT * FROM system.local"
164164
statement = SimpleStatement(query)
@@ -321,7 +321,7 @@ def _remove_proxy_setup(self):
321321
os.environ['KRB5_CONFIG'] = self.krb_conf
322322
self.refresh_kerberos_tickets(self.cassandra_keytab, "cassandra@DATASTAX.COM", self.krb_conf)
323323
auth_provider = DSEGSSAPIAuthProvider(service='dse', qops=["auth"], principal='cassandra@DATASTAX.COM')
324-
cluster = TestCluster(auth_provider=auth_provider)
324+
cluster = IntegrationTestCluster(auth_provider=auth_provider)
325325
session = cluster.connect()
326326

327327
session.execute("REVOKE PROXY.LOGIN ON ROLE '{0}' FROM '{1}'".format('charlie@DATASTAX.COM', 'bob@DATASTAX.COM'))
@@ -339,7 +339,7 @@ def _setup_for_proxy(self, grant=True):
339339
os.environ['KRB5_CONFIG'] = self.krb_conf
340340
self.refresh_kerberos_tickets(self.cassandra_keytab, "cassandra@DATASTAX.COM", self.krb_conf)
341341
auth_provider = DSEGSSAPIAuthProvider(service='dse', qops=["auth"], principal='cassandra@DATASTAX.COM')
342-
cluster = TestCluster(auth_provider=auth_provider)
342+
cluster = IntegrationTestCluster(auth_provider=auth_provider)
343343
session = cluster.connect()
344344

345345
stmts = [
@@ -404,7 +404,7 @@ def setUpClass(self):
404404
# Create users and test keyspace
405405
self.user_role = 'user1'
406406
self.server_role = 'server'
407-
self.root_cluster = TestCluster(auth_provider=DSEPlainTextAuthProvider('cassandra', 'cassandra'))
407+
self.root_cluster = IntegrationTestCluster(auth_provider=DSEPlainTextAuthProvider('cassandra', 'cassandra'))
408408
self.root_session = self.root_cluster.connect()
409409

410410
stmts = [
@@ -470,7 +470,7 @@ def get_sasl_options(self, mechanism='PLAIN'):
470470
return sasl_options
471471

472472
def connect_and_query(self, auth_provider, execute_as=None, query="SELECT * FROM testproxy.testproxy"):
473-
self.cluster = TestCluster(auth_provider=auth_provider)
473+
self.cluster = IntegrationTestCluster(auth_provider=auth_provider)
474474
self.session = self.cluster.connect()
475475
rs = self.session.execute(query, execute_as=execute_as)
476476
return rs

Diff for: tests/integration/advanced/test_cont_paging.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
from tests.integration import use_singledc, greaterthanorequaldse51, BasicSharedKeyspaceUnitTestCaseRF3WM, \
16-
DSE_VERSION, ProtocolVersion, greaterthanorequaldse60, requiredse, TestCluster
16+
DSE_VERSION, ProtocolVersion, greaterthanorequaldse60, requiredse, IntegrationTestCluster
1717

1818
import logging
1919
log = logging.getLogger(__name__)
@@ -64,7 +64,7 @@ def tearDownClass(cls):
6464
@classmethod
6565
def create_cluster(cls):
6666

67-
cls.cluster_with_profiles = TestCluster(protocol_version=cls.protocol_version, execution_profiles=cls.execution_profiles)
67+
cls.cluster_with_profiles = IntegrationTestCluster(protocol_version=cls.protocol_version, execution_profiles=cls.execution_profiles)
6868

6969
cls.session_with_profiles = cls.cluster_with_profiles.connect(wait_for_all_pools=True)
7070
statements_and_params = zip(

Diff for: tests/integration/advanced/test_cqlengine_where_operators.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
create_keyspace_simple, drop_table,
2626
sync_table)
2727
from cassandra.cqlengine.statements import IsNotNull
28-
from tests.integration import DSE_VERSION, requiredse, CASSANDRA_IP, greaterthanorequaldse60, TestCluster
28+
from tests.integration import DSE_VERSION, requiredse, CASSANDRA_IP, greaterthanorequaldse60, IntegrationTestCluster
2929
from tests.integration.advanced import use_single_node_with_graph_and_solr
3030
from tests.integration.cqlengine import DEFAULT_KEYSPACE
3131

@@ -64,7 +64,7 @@ class IsNotNullTests(unittest.TestCase):
6464
@classmethod
6565
def setUpClass(cls):
6666
if DSE_VERSION:
67-
cls.cluster = TestCluster()
67+
cls.cluster = IntegrationTestCluster()
6868

6969
@greaterthanorequaldse60
7070
def test_is_not_null_execution(self):
@@ -80,7 +80,7 @@ def test_is_not_null_execution(self):
8080
8181
@test_category cqlengine
8282
"""
83-
cluster = TestCluster()
83+
cluster = IntegrationTestCluster()
8484
self.addCleanup(cluster.shutdown)
8585
session = cluster.connect()
8686

Diff for: tests/integration/advanced/test_unixsocketendpoint.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
from cassandra.policies import WhiteListRoundRobinPolicy, RoundRobinPolicy
2626

2727
from tests import notwindows
28-
from tests.integration import use_single_node, TestCluster
28+
from tests.integration import use_single_node, IntegrationTestCluster
2929

3030
log = logging.getLogger()
3131
log.setLevel('DEBUG')
@@ -65,7 +65,7 @@ def setUpClass(cls):
6565
lbp = UnixSocketWhiteListRoundRobinPolicy([UNIX_SOCKET_PATH])
6666
ep = ExecutionProfile(load_balancing_policy=lbp)
6767
endpoint = UnixSocketEndPoint(UNIX_SOCKET_PATH)
68-
cls.cluster = TestCluster(contact_points=[endpoint], execution_profiles={EXEC_PROFILE_DEFAULT: ep})
68+
cls.cluster = IntegrationTestCluster(contact_points=[endpoint], execution_profiles={EXEC_PROFILE_DEFAULT: ep})
6969

7070
@classmethod
7171
def tearDownClass(cls):

Diff for: tests/integration/cqlengine/advanced/test_cont_paging.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
from cassandra.cqlengine import columns, connection, models
2828
from cassandra.cqlengine.management import drop_table, sync_table
2929
from tests.integration import (DSE_VERSION, greaterthanorequaldse51,
30-
greaterthanorequaldse60, requiredse, TestCluster)
30+
greaterthanorequaldse60, requiredse, IntegrationTestCluster)
3131

3232

3333
class TestMultiKeyModel(models.Model):
@@ -76,8 +76,8 @@ def tearDownClass(cls):
7676
def _create_cluster_with_cp_options(cls, name, cp_options):
7777
execution_profiles = {EXEC_PROFILE_DEFAULT:
7878
ExecutionProfile(continuous_paging_options=cp_options)}
79-
cls.cluster_default = TestCluster(protocol_version=cls.protocol_version,
80-
execution_profiles=execution_profiles)
79+
cls.cluster_default = IntegrationTestCluster(protocol_version=cls.protocol_version,
80+
execution_profiles=execution_profiles)
8181
cls.session_default = cls.cluster_default.connect(wait_for_all_pools=True)
8282
connection.register_connection(name, default=True, session=cls.session_default)
8383
cls.connections.add(name)

Diff for: tests/integration/cqlengine/connections/test_connection.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from cassandra.policies import RoundRobinPolicy
2727
from cassandra.query import dict_factory
2828

29-
from tests.integration import CASSANDRA_IP, PROTOCOL_VERSION, execute_with_long_wait_retry, local, TestCluster
29+
from tests.integration import CASSANDRA_IP, PROTOCOL_VERSION, execute_with_long_wait_retry, local, IntegrationTestCluster
3030
from tests.integration.cqlengine.base import BaseCassEngTestCase
3131
from tests.integration.cqlengine import DEFAULT_KEYSPACE, setup_connection
3232

@@ -76,7 +76,7 @@ def setUpClass(cls):
7676
cls.keyspace1 = 'ctest1'
7777
cls.keyspace2 = 'ctest2'
7878
super(SeveralConnectionsTest, cls).setUpClass()
79-
cls.setup_cluster = TestCluster()
79+
cls.setup_cluster = IntegrationTestCluster()
8080
cls.setup_session = cls.setup_cluster.connect()
8181
ddl = "CREATE KEYSPACE {0} WITH replication = {{'class': 'SimpleStrategy', 'replication_factor': '{1}'}}".format(cls.keyspace1, 1)
8282
execute_with_long_wait_retry(cls.setup_session, ddl)
@@ -93,7 +93,7 @@ def tearDownClass(cls):
9393
models.DEFAULT_KEYSPACE
9494

9595
def setUp(self):
96-
self.c = TestCluster()
96+
self.c = IntegrationTestCluster()
9797
self.session1 = self.c.connect(keyspace=self.keyspace1)
9898
self.session1.row_factory = dict_factory
9999
self.session2 = self.c.connect(keyspace=self.keyspace2)
@@ -149,23 +149,23 @@ def test_connection_with_legacy_settings(self):
149149
self.assertEqual(conn.cluster._config_mode, _ConfigMode.LEGACY)
150150

151151
def test_connection_from_session_with_execution_profile(self):
152-
cluster = TestCluster(execution_profiles={EXEC_PROFILE_DEFAULT: ExecutionProfile(row_factory=dict_factory)})
152+
cluster = IntegrationTestCluster(execution_profiles={EXEC_PROFILE_DEFAULT: ExecutionProfile(row_factory=dict_factory)})
153153
session = cluster.connect()
154154
connection.default()
155155
connection.set_session(session)
156156
conn = connection.get_connection()
157157
self.assertEqual(conn.cluster._config_mode, _ConfigMode.PROFILES)
158158

159159
def test_connection_from_session_with_legacy_settings(self):
160-
cluster = TestCluster(load_balancing_policy=RoundRobinPolicy())
160+
cluster = IntegrationTestCluster(load_balancing_policy=RoundRobinPolicy())
161161
session = cluster.connect()
162162
session.row_factory = dict_factory
163163
connection.set_session(session)
164164
conn = connection.get_connection()
165165
self.assertEqual(conn.cluster._config_mode, _ConfigMode.LEGACY)
166166

167167
def test_uncommitted_session_uses_legacy(self):
168-
cluster = TestCluster()
168+
cluster = IntegrationTestCluster()
169169
session = cluster.connect()
170170
session.row_factory = dict_factory
171171
connection.set_session(session)
@@ -186,7 +186,7 @@ def test_legacy_insert_query(self):
186186
self.assertEqual(ConnectionModel.objects(key=0)[0].some_data, 'text0')
187187

188188
def test_execution_profile_insert_query(self):
189-
cluster = TestCluster(execution_profiles={EXEC_PROFILE_DEFAULT: ExecutionProfile(row_factory=dict_factory)})
189+
cluster = IntegrationTestCluster(execution_profiles={EXEC_PROFILE_DEFAULT: ExecutionProfile(row_factory=dict_factory)})
190190
session = cluster.connect()
191191
connection.default()
192192
connection.set_session(session)

Diff for: tests/integration/cqlengine/query/test_queryset.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
from cassandra.util import uuid_from_time
4343
from cassandra.cqlengine.connection import get_session
4444
from tests.integration import PROTOCOL_VERSION, CASSANDRA_VERSION, greaterthancass20, greaterthancass21, \
45-
greaterthanorequalcass30, TestCluster
45+
greaterthanorequalcass30, IntegrationTestCluster
4646
from tests.integration.cqlengine import execute_count, DEFAULT_KEYSPACE
4747

4848

@@ -775,7 +775,7 @@ def test_custom_indexed_field_can_be_queried(self):
775775
with self.assertRaises(InvalidRequest):
776776
list(CustomIndexedTestModel.objects.filter(description__gte='test'))
777777

778-
with TestCluster().connect() as session:
778+
with IntegrationTestCluster().connect() as session:
779779
session.execute("CREATE INDEX custom_index_cqlengine ON {}.{} (description)".
780780
format(DEFAULT_KEYSPACE, CustomIndexedTestModel._table_name))
781781

Diff for: tests/integration/cqlengine/statements/test_base_statement.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
from tests.integration.cqlengine.base import BaseCassEngTestCase, TestQueryUpdateModel
3131
from tests.integration.cqlengine import DEFAULT_KEYSPACE
32-
from tests.integration import greaterthanorequalcass3_10, TestCluster
32+
from tests.integration import greaterthanorequalcass3_10, IntegrationTestCluster
3333

3434
from cassandra.cqlengine.connection import execute
3535

@@ -115,7 +115,7 @@ def test_like_operator(self):
115115
116116
@test_category data_types:object_mapper
117117
"""
118-
cluster = TestCluster()
118+
cluster = IntegrationTestCluster()
119119
session = cluster.connect()
120120
self.addCleanup(cluster.shutdown)
121121

Diff for: tests/integration/cqlengine/test_connections.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from tests.integration.cqlengine import setup_connection, DEFAULT_KEYSPACE
2323
from tests.integration.cqlengine.base import BaseCassEngTestCase
2424
from tests.integration.cqlengine.query import test_queryset
25-
from tests.integration import local, CASSANDRA_IP, TestCluster
25+
from tests.integration import local, CASSANDRA_IP, IntegrationTestCluster
2626

2727

2828
class TestModel(Model):
@@ -226,7 +226,7 @@ def test_connection_creation_from_session(self):
226226
227227
@test_category object_mapper
228228
"""
229-
cluster = TestCluster()
229+
cluster = IntegrationTestCluster()
230230
session = cluster.connect()
231231
connection_name = 'from_session'
232232
conn.register_connection(connection_name, session=session)
@@ -257,7 +257,7 @@ def test_connection_param_validation(self):
257257
258258
@test_category object_mapper
259259
"""
260-
cluster = TestCluster()
260+
cluster = IntegrationTestCluster()
261261
session = cluster.connect()
262262
with self.assertRaises(CQLEngineException):
263263
conn.register_connection("bad_coonection1", session=session, consistency="not_null")

0 commit comments

Comments
 (0)