Skip to content
Merged
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
3 changes: 2 additions & 1 deletion tests/integration/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def set_default_cass_ip():

def set_default_beta_flag_true():
defaults = list(Cluster.__init__.__defaults__)
defaults = defaults[:-3] + [True] + defaults[-2:]
defaults = (defaults[:28] + [True] + defaults[29:])
try:
Cluster.__init__.__defaults__ = tuple(defaults)
except:
Expand Down Expand Up @@ -255,6 +255,7 @@ def get_unsupported_upper_protocol():
greaterthanorequalcass3_10 = unittest.skipUnless(CASSANDRA_VERSION >= '3.10', 'Cassandra version 3.10 or greater required')
greaterthanorequalcass3_11 = unittest.skipUnless(CASSANDRA_VERSION >= '3.11', 'Cassandra version 3.10 or greater required')
greaterthanorequalcass40 = unittest.skipUnless(CASSANDRA_VERSION >= '4.0', 'Cassandra version 4.0 or greater required')
lessthanorequalcass40 = unittest.skipIf(CASSANDRA_VERSION >= '4.0', 'Cassandra version 4.0 or greater required')
lessthancass30 = unittest.skipUnless(CASSANDRA_VERSION < '3.0', 'Cassandra version less then 3.0 required')
dseonly = unittest.skipUnless(DSE_VERSION, "Test is only applicalbe to DSE clusters")
pypy = unittest.skipUnless(platform.python_implementation() == "PyPy", "Test is skipped unless it's on PyPy")
Expand Down
62 changes: 60 additions & 2 deletions tests/integration/standard/test_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
from tests import notwindows
from tests.integration import use_singledc, PROTOCOL_VERSION, get_server_versions, CASSANDRA_VERSION, \
execute_until_pass, execute_with_long_wait_retry, get_node, MockLoggingHandler, get_unsupported_lower_protocol, \
get_unsupported_upper_protocol, protocolv5, local, CASSANDRA_IP
get_unsupported_upper_protocol, protocolv5, local, CASSANDRA_IP, greaterthanorequalcass30, lessthanorequalcass40
from tests.integration.util import assert_quiescent_pool_state
import sys

Expand Down Expand Up @@ -1062,6 +1062,63 @@ def test_replicas_are_queried(self):

session.execute('''DROP TABLE test1rf.table_with_big_key''')

@unittest.skip
@greaterthanorequalcass30
@lessthanorequalcass40
def test_compact_option(self):
"""
Test the driver can connect with the no_compact option and the results
are as expected. This test is very similar to the corresponding dtest

@since 3.12
@jira_ticket PYTHON-366
@expected_result only one hosts' metadata will be populated

@test_category connection
"""
nc_cluster = Cluster(protocol_version=PROTOCOL_VERSION, no_compact=True)
nc_session = nc_cluster.connect()

cluster = Cluster(protocol_version=PROTOCOL_VERSION, no_compact=False)
session = cluster.connect()

self.addCleanup(cluster.shutdown)
self.addCleanup(nc_cluster.shutdown)

nc_session.set_keyspace("test3rf")
session.set_keyspace("test3rf")

nc_session.execute(
"CREATE TABLE IF NOT EXISTS compact_table (k int PRIMARY KEY, v1 int, v2 int) WITH COMPACT STORAGE;")

for i in range(1, 5):
nc_session.execute(
"INSERT INTO compact_table (k, column1, v1, v2, value) VALUES "
"({i}, 'a{i}', {i}, {i}, textAsBlob('b{i}'))".format(i=i))
nc_session.execute(
"INSERT INTO compact_table (k, column1, v1, v2, value) VALUES "
"({i}, 'a{i}{i}', {i}{i}, {i}{i}, textAsBlob('b{i}{i}'))".format(i=i))

nc_results = nc_session.execute("SELECT * FROM compact_table")
self.assertEqual(
set(nc_results.current_rows),
{(1, u'a1', 11, 11, 'b1'),
(1, u'a11', 11, 11, 'b11'),
(2, u'a2', 22, 22, 'b2'),
(2, u'a22', 22, 22, 'b22'),
(3, u'a3', 33, 33, 'b3'),
(3, u'a33', 33, 33, 'b33'),
(4, u'a4', 44, 44, 'b4'),
(4, u'a44', 44, 44, 'b44')})

results = session.execute("SELECT * FROM compact_table")
self.assertEqual(
set(results.current_rows),
{(1, 11, 11),
(2, 22, 22),
(3, 33, 33),
(4, 44, 44)})

def _assert_replica_queried(self, trace, only_replicas=True):
queried_hosts = set()
for row in trace.events:
Expand Down Expand Up @@ -1255,6 +1312,7 @@ def test_down_event_with_active_connection(self):
time.sleep(.01)
self.assertTrue(was_marked_down)


@local
class DontPrepareOnIgnoredHostsTest(unittest.TestCase):
ignored_addresses = ['127.0.0.3']
Expand Down Expand Up @@ -1292,6 +1350,7 @@ def test_prepare_on_ignored_hosts(self):
self.assertEqual(call(unignored_address), c)
cluster.shutdown()


@local
class DuplicateRpcTest(unittest.TestCase):

Expand Down Expand Up @@ -1331,7 +1390,6 @@ def test_duplicate(self):
test_cluster.shutdown()



@protocolv5
class BetaProtocolTest(unittest.TestCase):

Expand Down