Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(tests/integration/__init__.py): Rename "TestCluster" to "IntegrationTestCluster" #1121

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions tests/integration/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def get_server_versions():
if cass_version is not None:
return (cass_version, cql_version)

c = TestCluster()
c = IntegrationTestCluster()
s = c.connect()
row = s.execute('SELECT cql_version, release_version FROM system.local')[0]

Expand Down Expand Up @@ -703,9 +703,9 @@ def setup_keyspace(ipformat=None, wait=True, protocol_version=None):
_protocol_version = PROTOCOL_VERSION

if not ipformat:
cluster = TestCluster(protocol_version=_protocol_version)
cluster = IntegrationTestCluster(protocol_version=_protocol_version)
else:
cluster = TestCluster(contact_points=["::1"], protocol_version=_protocol_version)
cluster = IntegrationTestCluster(contact_points=["::1"], protocol_version=_protocol_version)
session = cluster.connect()

try:
Expand Down Expand Up @@ -799,7 +799,7 @@ def create_keyspace(cls, rf):

@classmethod
def common_setup(cls, rf, keyspace_creation=True, create_class_table=False, **cluster_kwargs):
cls.cluster = TestCluster(**cluster_kwargs)
cls.cluster = IntegrationTestCluster(**cluster_kwargs)
cls.session = cls.cluster.connect(wait_for_all_pools=True)
cls.ks_name = cls.__name__.lower()
if keyspace_creation:
Expand Down Expand Up @@ -987,7 +987,7 @@ def assert_startswith(s, prefix):
)


class TestCluster(object):
class IntegrationTestCluster(object):
DEFAULT_PROTOCOL_VERSION = default_protocol_version
DEFAULT_CASSANDRA_IP = CASSANDRA_IP
DEFAULT_ALLOW_BETA = ALLOW_BETA_PROTOCOL
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/advanced/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from ccmlib import common

from tests.integration import get_server_versions, BasicKeyspaceUnitTestCase, \
drop_keyspace_shutdown_cluster, get_node, USE_CASS_EXTERNAL, TestCluster
drop_keyspace_shutdown_cluster, get_node, USE_CASS_EXTERNAL, IntegrationTestCluster
from tests.integration import use_singledc, use_single_node, wait_for_node_socket, CASSANDRA_IP

home = expanduser('~')
Expand Down Expand Up @@ -103,7 +103,7 @@ def use_cluster_with_graph(num_nodes):
# Wait for spark master to start up
spark_master_http = ("localhost", 7080)
common.check_socket_listening(spark_master_http, timeout=60)
tmp_cluster = TestCluster()
tmp_cluster = IntegrationTestCluster()

# Start up remaining nodes.
try:
Expand Down Expand Up @@ -131,7 +131,7 @@ class BasicGeometricUnitTestCase(BasicKeyspaceUnitTestCase):

@classmethod
def common_dse_setup(cls, rf, keyspace_creation=True):
cls.cluster = TestCluster()
cls.cluster = IntegrationTestCluster()
cls.session = cls.cluster.connect()
cls.ks_name = cls.__name__.lower()
if keyspace_creation:
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/advanced/graph/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def session_setup(self):
)
)

self.cluster = TestCluster(execution_profiles={
self.cluster = IntegrationTestCluster(execution_profiles={
EXEC_PROFILE_GRAPH_DEFAULT: ep_graphson1,
EXEC_PROFILE_GRAPH_ANALYTICS_DEFAULT: ep_analytics,
"graphson1": ep_graphson1,
Expand Down Expand Up @@ -275,7 +275,7 @@ def session_setup(self):
)
)

self.cluster = TestCluster(execution_profiles={
self.cluster = IntegrationTestCluster(execution_profiles={
EXEC_PROFILE_GRAPH_DEFAULT: ep_graphson1,
EXEC_PROFILE_GRAPH_ANALYTICS_DEFAULT: ep_analytics,
"graphson1": ep_graphson1,
Expand Down Expand Up @@ -360,7 +360,7 @@ class BasicSharedGraphUnitTestCase(BasicKeyspaceUnitTestCase):

@classmethod
def session_setup(cls):
cls.cluster = TestCluster()
cls.cluster = IntegrationTestCluster()
cls.session = cls.cluster.connect()
cls.ks_name = cls.__name__.lower()
cls.cass_version, cls.cql_version = get_server_versions()
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/advanced/graph/test_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from cassandra.util import SortedSet

from tests.integration import DSE_VERSION, greaterthanorequaldse51, greaterthanorequaldse68, \
requiredse, TestCluster
requiredse, IntegrationTestCluster
from tests.integration.advanced.graph import BasicGraphUnitTestCase, GraphUnitTestCase, \
GraphProtocol, ClassicGraphSchema, CoreGraphSchema, use_single_node_with_graph

Expand Down Expand Up @@ -150,7 +150,7 @@ def test_graph_profile(self):
exec_short_timeout.graph_options.graph_name = self.graph_name

# Add a single execution policy on cluster creation
local_cluster = TestCluster(execution_profiles={"exec_dif_factory": exec_dif_factory})
local_cluster = IntegrationTestCluster(execution_profiles={"exec_dif_factory": exec_dif_factory})
local_session = local_cluster.connect()
self.addCleanup(local_cluster.shutdown)

Expand Down
4 changes: 2 additions & 2 deletions tests/integration/advanced/test_adv_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
BasicSharedKeyspaceUnitTestCaseRF1,
greaterthanorequaldse51, greaterthanorequaldse60,
greaterthanorequaldse68, use_single_node,
DSE_VERSION, requiredse, TestCluster)
DSE_VERSION, requiredse, IntegrationTestCluster)

import unittest

Expand Down Expand Up @@ -389,4 +389,4 @@ def test_connection_on_graph_schema_error(self):
""" % (self.ks_name,))

self.session.execute('TRUNCATE system_schema.vertices')
TestCluster().connect().shutdown()
IntegrationTestCluster().connect().shutdown()
12 changes: 6 additions & 6 deletions tests/integration/advanced/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from cassandra.protocol import Unauthorized
from cassandra.query import SimpleStatement
from tests.integration import (get_cluster, greaterthanorequaldse51,
remove_cluster, requiredse, DSE_VERSION, TestCluster)
remove_cluster, requiredse, DSE_VERSION, IntegrationTestCluster)
from tests.integration.advanced import ADS_HOME, use_single_node_with_graph
from tests.integration.advanced.graph import reset_graph, ClassicGraphFixtures

Expand Down Expand Up @@ -155,7 +155,7 @@ def connect_and_query(self, auth_provider, query=None):
Runs a simple system query with the auth_provided specified.
"""
os.environ['KRB5_CONFIG'] = self.krb_conf
self.cluster = TestCluster(auth_provider=auth_provider)
self.cluster = IntegrationTestCluster(auth_provider=auth_provider)
self.session = self.cluster.connect()
query = query if query else "SELECT * FROM system.local"
statement = SimpleStatement(query)
Expand Down Expand Up @@ -318,7 +318,7 @@ def _remove_proxy_setup(self):
os.environ['KRB5_CONFIG'] = self.krb_conf
self.refresh_kerberos_tickets(self.cassandra_keytab, "[email protected]", self.krb_conf)
auth_provider = DSEGSSAPIAuthProvider(service='dse', qops=["auth"], principal='[email protected]')
cluster = TestCluster(auth_provider=auth_provider)
cluster = IntegrationTestCluster(auth_provider=auth_provider)
session = cluster.connect()

session.execute("REVOKE PROXY.LOGIN ON ROLE '{0}' FROM '{1}'".format('[email protected]', '[email protected]'))
Expand All @@ -336,7 +336,7 @@ def _setup_for_proxy(self, grant=True):
os.environ['KRB5_CONFIG'] = self.krb_conf
self.refresh_kerberos_tickets(self.cassandra_keytab, "[email protected]", self.krb_conf)
auth_provider = DSEGSSAPIAuthProvider(service='dse', qops=["auth"], principal='[email protected]')
cluster = TestCluster(auth_provider=auth_provider)
cluster = IntegrationTestCluster(auth_provider=auth_provider)
session = cluster.connect()

stmts = [
Expand Down Expand Up @@ -401,7 +401,7 @@ def setUpClass(self):
# Create users and test keyspace
self.user_role = 'user1'
self.server_role = 'server'
self.root_cluster = TestCluster(auth_provider=DSEPlainTextAuthProvider('cassandra', 'cassandra'))
self.root_cluster = IntegrationTestCluster(auth_provider=DSEPlainTextAuthProvider('cassandra', 'cassandra'))
self.root_session = self.root_cluster.connect()

stmts = [
Expand Down Expand Up @@ -467,7 +467,7 @@ def get_sasl_options(self, mechanism='PLAIN'):
return sasl_options

def connect_and_query(self, auth_provider, execute_as=None, query="SELECT * FROM testproxy.testproxy"):
self.cluster = TestCluster(auth_provider=auth_provider)
self.cluster = IntegrationTestCluster(auth_provider=auth_provider)
self.session = self.cluster.connect()
rs = self.session.execute(query, execute_as=execute_as)
return rs
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/advanced/test_cont_paging.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

from tests.integration import use_singledc, greaterthanorequaldse51, BasicSharedKeyspaceUnitTestCaseRF3WM, \
DSE_VERSION, ProtocolVersion, greaterthanorequaldse60, requiredse, TestCluster
DSE_VERSION, ProtocolVersion, greaterthanorequaldse60, requiredse, IntegrationTestCluster

import logging
log = logging.getLogger(__name__)
Expand Down Expand Up @@ -61,7 +61,7 @@ def tearDownClass(cls):
@classmethod
def create_cluster(cls):

cls.cluster_with_profiles = TestCluster(protocol_version=cls.protocol_version, execution_profiles=cls.execution_profiles)
cls.cluster_with_profiles = IntegrationTestCluster(protocol_version=cls.protocol_version, execution_profiles=cls.execution_profiles)

cls.session_with_profiles = cls.cluster_with_profiles.connect(wait_for_all_pools=True)
statements_and_params = zip(
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/advanced/test_cqlengine_where_operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
create_keyspace_simple, drop_table,
sync_table)
from cassandra.cqlengine.statements import IsNotNull
from tests.integration import DSE_VERSION, requiredse, CASSANDRA_IP, greaterthanorequaldse60, TestCluster
from tests.integration import DSE_VERSION, requiredse, CASSANDRA_IP, greaterthanorequaldse60, IntegrationTestCluster
from tests.integration.advanced import use_single_node_with_graph_and_solr
from tests.integration.cqlengine import DEFAULT_KEYSPACE

Expand Down Expand Up @@ -61,7 +61,7 @@ class IsNotNullTests(unittest.TestCase):
@classmethod
def setUpClass(cls):
if DSE_VERSION:
cls.cluster = TestCluster()
cls.cluster = IntegrationTestCluster()

@greaterthanorequaldse60
def test_is_not_null_execution(self):
Expand All @@ -77,7 +77,7 @@ def test_is_not_null_execution(self):

@test_category cqlengine
"""
cluster = TestCluster()
cluster = IntegrationTestCluster()
self.addCleanup(cluster.shutdown)
session = cluster.connect()

Expand Down
4 changes: 2 additions & 2 deletions tests/integration/advanced/test_unixsocketendpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from cassandra.policies import WhiteListRoundRobinPolicy, RoundRobinPolicy

from tests import notwindows
from tests.integration import use_single_node, TestCluster
from tests.integration import use_single_node, IntegrationTestCluster

log = logging.getLogger()
log.setLevel('DEBUG')
Expand Down Expand Up @@ -62,7 +62,7 @@ def setUpClass(cls):
lbp = UnixSocketWhiteListRoundRobinPolicy([UNIX_SOCKET_PATH])
ep = ExecutionProfile(load_balancing_policy=lbp)
endpoint = UnixSocketEndPoint(UNIX_SOCKET_PATH)
cls.cluster = TestCluster(contact_points=[endpoint], execution_profiles={EXEC_PROFILE_DEFAULT: ep})
cls.cluster = IntegrationTestCluster(contact_points=[endpoint], execution_profiles={EXEC_PROFILE_DEFAULT: ep})

@classmethod
def tearDownClass(cls):
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/cqlengine/advanced/test_cont_paging.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from cassandra.cqlengine import columns, connection, models
from cassandra.cqlengine.management import drop_table, sync_table
from tests.integration import (DSE_VERSION, greaterthanorequaldse51,
greaterthanorequaldse60, requiredse, TestCluster)
greaterthanorequaldse60, requiredse, IntegrationTestCluster)


class TestMultiKeyModel(models.Model):
Expand Down Expand Up @@ -73,8 +73,8 @@ def tearDownClass(cls):
def _create_cluster_with_cp_options(cls, name, cp_options):
execution_profiles = {EXEC_PROFILE_DEFAULT:
ExecutionProfile(continuous_paging_options=cp_options)}
cls.cluster_default = TestCluster(protocol_version=cls.protocol_version,
execution_profiles=execution_profiles)
cls.cluster_default = IntegrationTestCluster(protocol_version=cls.protocol_version,
execution_profiles=execution_profiles)
cls.session_default = cls.cluster_default.connect(wait_for_all_pools=True)
connection.register_connection(name, default=True, session=cls.session_default)
cls.connections.add(name)
Expand Down
14 changes: 7 additions & 7 deletions tests/integration/cqlengine/connections/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from cassandra.policies import RoundRobinPolicy
from cassandra.query import dict_factory

from tests.integration import CASSANDRA_IP, PROTOCOL_VERSION, execute_with_long_wait_retry, local, TestCluster
from tests.integration import CASSANDRA_IP, PROTOCOL_VERSION, execute_with_long_wait_retry, local, IntegrationTestCluster
from tests.integration.cqlengine.base import BaseCassEngTestCase
from tests.integration.cqlengine import DEFAULT_KEYSPACE, setup_connection

Expand Down Expand Up @@ -73,7 +73,7 @@ def setUpClass(cls):
cls.keyspace1 = 'ctest1'
cls.keyspace2 = 'ctest2'
super(SeveralConnectionsTest, cls).setUpClass()
cls.setup_cluster = TestCluster()
cls.setup_cluster = IntegrationTestCluster()
cls.setup_session = cls.setup_cluster.connect()
ddl = "CREATE KEYSPACE {0} WITH replication = {{'class': 'SimpleStrategy', 'replication_factor': '{1}'}}".format(cls.keyspace1, 1)
execute_with_long_wait_retry(cls.setup_session, ddl)
Expand All @@ -90,7 +90,7 @@ def tearDownClass(cls):
models.DEFAULT_KEYSPACE

def setUp(self):
self.c = TestCluster()
self.c = IntegrationTestCluster()
self.session1 = self.c.connect(keyspace=self.keyspace1)
self.session1.row_factory = dict_factory
self.session2 = self.c.connect(keyspace=self.keyspace2)
Expand Down Expand Up @@ -146,23 +146,23 @@ def test_connection_with_legacy_settings(self):
self.assertEqual(conn.cluster._config_mode, _ConfigMode.LEGACY)

def test_connection_from_session_with_execution_profile(self):
cluster = TestCluster(execution_profiles={EXEC_PROFILE_DEFAULT: ExecutionProfile(row_factory=dict_factory)})
cluster = IntegrationTestCluster(execution_profiles={EXEC_PROFILE_DEFAULT: ExecutionProfile(row_factory=dict_factory)})
session = cluster.connect()
connection.default()
connection.set_session(session)
conn = connection.get_connection()
self.assertEqual(conn.cluster._config_mode, _ConfigMode.PROFILES)

def test_connection_from_session_with_legacy_settings(self):
cluster = TestCluster(load_balancing_policy=RoundRobinPolicy())
cluster = IntegrationTestCluster(load_balancing_policy=RoundRobinPolicy())
session = cluster.connect()
session.row_factory = dict_factory
connection.set_session(session)
conn = connection.get_connection()
self.assertEqual(conn.cluster._config_mode, _ConfigMode.LEGACY)

def test_uncommitted_session_uses_legacy(self):
cluster = TestCluster()
cluster = IntegrationTestCluster()
session = cluster.connect()
session.row_factory = dict_factory
connection.set_session(session)
Expand All @@ -183,7 +183,7 @@ def test_legacy_insert_query(self):
self.assertEqual(ConnectionModel.objects(key=0)[0].some_data, 'text0')

def test_execution_profile_insert_query(self):
cluster = TestCluster(execution_profiles={EXEC_PROFILE_DEFAULT: ExecutionProfile(row_factory=dict_factory)})
cluster = IntegrationTestCluster(execution_profiles={EXEC_PROFILE_DEFAULT: ExecutionProfile(row_factory=dict_factory)})
session = cluster.connect()
connection.default()
connection.set_session(session)
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/cqlengine/query/test_queryset.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
from cassandra.util import uuid_from_time
from cassandra.cqlengine.connection import get_session
from tests.integration import PROTOCOL_VERSION, CASSANDRA_VERSION, greaterthancass20, greaterthancass21, \
greaterthanorequalcass30, TestCluster
greaterthanorequalcass30, IntegrationTestCluster
from tests.integration.cqlengine import execute_count, DEFAULT_KEYSPACE


Expand Down Expand Up @@ -772,7 +772,7 @@ def test_custom_indexed_field_can_be_queried(self):
with self.assertRaises(InvalidRequest):
list(CustomIndexedTestModel.objects.filter(description__gte='test'))

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

Expand Down
4 changes: 2 additions & 2 deletions tests/integration/cqlengine/statements/test_base_statement.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

from tests.integration.cqlengine.base import BaseCassEngTestCase, TestQueryUpdateModel
from tests.integration.cqlengine import DEFAULT_KEYSPACE
from tests.integration import greaterthanorequalcass3_10, TestCluster
from tests.integration import greaterthanorequalcass3_10, IntegrationTestCluster

from cassandra.cqlengine.connection import execute

Expand Down Expand Up @@ -112,7 +112,7 @@ def test_like_operator(self):

@test_category data_types:object_mapper
"""
cluster = TestCluster()
cluster = IntegrationTestCluster()
session = cluster.connect()
self.addCleanup(cluster.shutdown)

Expand Down
6 changes: 3 additions & 3 deletions tests/integration/cqlengine/test_connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from tests.integration.cqlengine import setup_connection, DEFAULT_KEYSPACE
from tests.integration.cqlengine.base import BaseCassEngTestCase
from tests.integration.cqlengine.query import test_queryset
from tests.integration import local, CASSANDRA_IP, TestCluster
from tests.integration import local, CASSANDRA_IP, IntegrationTestCluster


class TestModel(Model):
Expand Down Expand Up @@ -226,7 +226,7 @@ def test_connection_creation_from_session(self):

@test_category object_mapper
"""
cluster = TestCluster()
cluster = IntegrationTestCluster()
session = cluster.connect()
connection_name = 'from_session'
conn.register_connection(connection_name, session=session)
Expand Down Expand Up @@ -257,7 +257,7 @@ def test_connection_param_validation(self):

@test_category object_mapper
"""
cluster = TestCluster()
cluster = IntegrationTestCluster()
session = cluster.connect()
with self.assertRaises(CQLEngineException):
conn.register_connection("bad_coonection1", session=session, consistency="not_null")
Expand Down
Loading