Skip to content

Commit f19ae5a

Browse files
committed
Various test timing fixes
1 parent d0e7f4b commit f19ae5a

4 files changed

Lines changed: 12 additions & 12 deletions

File tree

tests/integration/long/test_consistency.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def _test_tokenaware_one_node_down(self, keyspace, rf, accepted):
130130
cluster = Cluster(
131131
load_balancing_policy=TokenAwarePolicy(RoundRobinPolicy()),
132132
protocol_version=PROTOCOL_VERSION)
133-
session = cluster.connect()
133+
session = cluster.connect(wait_for_all_pools=True)
134134
wait_for_up(cluster, 1)
135135
wait_for_up(cluster, 2)
136136

@@ -182,7 +182,7 @@ def test_rfthree_tokenaware_none_down(self):
182182
cluster = Cluster(
183183
load_balancing_policy=TokenAwarePolicy(RoundRobinPolicy()),
184184
protocol_version=PROTOCOL_VERSION)
185-
session = cluster.connect()
185+
session = cluster.connect(wait_for_all_pools=True)
186186
wait_for_up(cluster, 1)
187187
wait_for_up(cluster, 2)
188188

@@ -207,7 +207,7 @@ def _test_downgrading_cl(self, keyspace, rf, accepted):
207207
load_balancing_policy=TokenAwarePolicy(RoundRobinPolicy()),
208208
default_retry_policy=DowngradingConsistencyRetryPolicy(),
209209
protocol_version=PROTOCOL_VERSION)
210-
session = cluster.connect()
210+
session = cluster.connect(wait_for_all_pools=True)
211211

212212
create_schema(cluster, session, keyspace, replication_factor=rf)
213213
self._insert(session, keyspace, 1)
@@ -262,7 +262,7 @@ def test_rfthree_tokenaware_downgradingcl(self):
262262
self.rfthree_downgradingcl(cluster, keyspace, False)
263263

264264
def rfthree_downgradingcl(self, cluster, keyspace, roundrobin):
265-
session = cluster.connect()
265+
session = cluster.connect(wait_for_all_pools=True)
266266

267267
create_schema(cluster, session, keyspace, replication_factor=2)
268268
self._insert(session, keyspace, count=12)
@@ -330,7 +330,7 @@ def test_pool_with_host_down(self):
330330

331331
# find the first node, we will try create connections to, shut it down.
332332
cluster = Cluster(protocol_version=PROTOCOL_VERSION)
333-
cluster.connect()
333+
cluster.connect(wait_for_all_pools=True)
334334
hosts = cluster.metadata.all_hosts()
335335
address = hosts[0].address
336336
node_to_stop = int(address.split('.')[-1:][0])

tests/integration/standard/test_metadata.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1189,7 +1189,7 @@ def test_legacy_tables(self):
11891189
11901190
CREATE TABLE legacy.composite_comp_with_col (
11911191
key blob,
1192-
column1 'org.apache.cassandra.db.marshal.DynamicCompositeType(t=>org.apache.cassandra.db.marshal.TimeUUIDType, b=>org.apache.cassandra.db.marshal.BytesType, s=>org.apache.cassandra.db.marshal.UTF8Type)',
1192+
column1 'org.apache.cassandra.db.marshal.DynamicCompositeType(b=>org.apache.cassandra.db.marshal.BytesType, s=>org.apache.cassandra.db.marshal.UTF8Type, t=>org.apache.cassandra.db.marshal.TimeUUIDType)',
11931193
"b@6869746d65776974686d75736963" blob,
11941194
"b@6d616d6d616a616d6d61" blob,
11951195
PRIMARY KEY (key, column1)
@@ -1309,7 +1309,7 @@ def test_legacy_tables(self):
13091309
13101310
CREATE TABLE legacy.composite_comp_no_col (
13111311
key blob,
1312-
column1 'org.apache.cassandra.db.marshal.DynamicCompositeType(t=>org.apache.cassandra.db.marshal.TimeUUIDType, b=>org.apache.cassandra.db.marshal.BytesType, s=>org.apache.cassandra.db.marshal.UTF8Type)',
1312+
column1 'org.apache.cassandra.db.marshal.DynamicCompositeType(b=>org.apache.cassandra.db.marshal.BytesType, s=>org.apache.cassandra.db.marshal.UTF8Type, t=>org.apache.cassandra.db.marshal.TimeUUIDType)',
13131313
value blob,
13141314
PRIMARY KEY (key, column1)
13151315
) WITH COMPACT STORAGE

tests/integration/standard/test_query.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ def _wait_for_trace_to_delete(self, trace_id):
245245
def _is_trace_present(self, trace_id):
246246
select_statement = SimpleStatement("SElECT duration FROM system_traces.sessions WHERE session_id = {0}".format(trace_id), consistency_level=ConsistencyLevel.ALL)
247247
ssrs = self.session.execute(select_statement)
248-
if(ssrs[0].duration is None):
248+
if not len(ssrs.current_rows) or ssrs[0].duration is None:
249249
return False
250250
return True
251251

tests/integration/standard/test_query_paging.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def setUp(self):
4747
self.cluster = Cluster(protocol_version=PROTOCOL_VERSION)
4848
if PROTOCOL_VERSION < 3:
4949
self.cluster.set_core_connections_per_host(HostDistance.LOCAL, 1)
50-
self.session = self.cluster.connect()
50+
self.session = self.cluster.connect(wait_for_all_pools=True)
5151
self.session.execute("TRUNCATE test3rf.test")
5252

5353
def tearDown(self):
@@ -262,7 +262,7 @@ def test_paging_callbacks(self):
262262

263263
for fetch_size in (2, 3, 7, 10, 99, 100, 101, 10000):
264264
self.session.default_fetch_size = fetch_size
265-
future = self.session.execute_async("SELECT * FROM test3rf.test")
265+
future = self.session.execute_async("SELECT * FROM test3rf.test", timeout=20)
266266

267267
event = Event()
268268
counter = count()
@@ -285,7 +285,7 @@ def handle_error(err):
285285
self.assertEqual(next(counter), 100)
286286

287287
# simple statement
288-
future = self.session.execute_async(SimpleStatement("SELECT * FROM test3rf.test"))
288+
future = self.session.execute_async(SimpleStatement("SELECT * FROM test3rf.test"), timeout=20)
289289
event.clear()
290290
counter = count()
291291

@@ -294,7 +294,7 @@ def handle_error(err):
294294
self.assertEqual(next(counter), 100)
295295

296296
# prepared statement
297-
future = self.session.execute_async(prepared)
297+
future = self.session.execute_async(prepared, timeout=20)
298298
event.clear()
299299
counter = count()
300300

0 commit comments

Comments
 (0)