From 4e6468574f21038d84d935bfaba4126452e843f4 Mon Sep 17 00:00:00 2001 From: GregBestland Date: Wed, 27 Apr 2016 12:26:45 -0500 Subject: [PATCH] Allowing heartbeat test to run against C* 2.0. Fixing issue with legacy table test. --- tests/integration/standard/test_connection.py | 12 +++++++++--- tests/integration/standard/test_metadata.py | 10 +++++----- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/tests/integration/standard/test_connection.py b/tests/integration/standard/test_connection.py index f7acae67..2d07b920 100644 --- a/tests/integration/standard/test_connection.py +++ b/tests/integration/standard/test_connection.py @@ -29,6 +29,7 @@ from cassandra.io.asyncorereactor import AsyncoreConnection from cassandra.protocol import QueryMessage from cassandra.connection import Connection from cassandra.policies import WhiteListRoundRobinPolicy, HostStateListener +from cassandra.pool import HostConnectionPool from tests import is_monkey_patched from tests.integration import use_singledc, PROTOCOL_VERSION, get_node @@ -125,6 +126,7 @@ class HeartbeatTest(unittest.TestCase): rs.result() current_host = str(rs._current_host) count += 1 + time.sleep(.1) self.assertLess(count, 100, "Never connected to the first node") new_connections = self.wait_for_connections(host, self.cluster) self.assertIsNone(test_listener.host_down) @@ -138,8 +140,12 @@ class HeartbeatTest(unittest.TestCase): holders = cluster.get_connection_holders() for conn in holders: if host == str(getattr(conn, 'host', '')): - if conn._connection is not None: - connections.append(conn._connection) + if isinstance(conn, HostConnectionPool): + if conn._connections is not None: + connections.append(conn._connections) + else: + if conn._connection is not None: + connections.append(conn._connection) return connections def wait_for_connections(self, host, cluster): @@ -159,7 +165,7 @@ class HeartbeatTest(unittest.TestCase): connections = self.fetch_connections(host, cluster) if len(connections) is 0: return - time.sleep(.1) + time.sleep(.5) self.fail("Connections never cleared") diff --git a/tests/integration/standard/test_metadata.py b/tests/integration/standard/test_metadata.py index fdcb9b86..4d86723f 100644 --- a/tests/integration/standard/test_metadata.py +++ b/tests/integration/standard/test_metadata.py @@ -1134,14 +1134,14 @@ Approximate structure, for reference: CREATE TABLE legacy.composite_comp_with_col ( key blob, - t timeuuid, b blob, s text, + t timeuuid, "b@6869746d65776974686d75736963" blob, "b@6d616d6d616a616d6d61" blob, - PRIMARY KEY (key, t, b, s) + PRIMARY KEY (key, b, s, t) ) WITH COMPACT STORAGE - AND CLUSTERING ORDER BY (t ASC, b ASC, s ASC) + AND CLUSTERING ORDER BY (b ASC, s ASC, t ASC) AND caching = '{"keys":"ALL", "rows_per_partition":"NONE"}' AND comment = 'Stores file meta data' AND compaction = {'min_threshold': '4', 'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32'} @@ -1262,8 +1262,8 @@ Approximate structure, for reference: CREATE TABLE legacy.composite_comp_no_col ( key blob, - column1 'org.apache.cassandra.db.marshal.DynamicCompositeType(org.apache.cassandra.db.marshal.TimeUUIDType, org.apache.cassandra.db.marshal.BytesType, org.apache.cassandra.db.marshal.UTF8Type)', - column2 text, + column1 'org.apache.cassandra.db.marshal.DynamicCompositeType(org.apache.cassandra.db.marshal.BytesType, org.apache.cassandra.db.marshal.UTF8Type, org.apache.cassandra.db.marshal.TimeUUIDType)', + column2 timeuuid, value blob, PRIMARY KEY (key, column1, column1, column2) ) WITH COMPACT STORAGE