Merge pull request #719 from datastax/python-jenkins-fixes

Fixed some failing tests in Jenkins
This commit is contained in:
Jaume Marhuenda
2017-03-27 09:49:15 -04:00
committed by GitHub
7 changed files with 15 additions and 19 deletions

View File

@@ -28,7 +28,8 @@ from threading import Event
from subprocess import call
from itertools import groupby
from cassandra import OperationTimedOut, ReadTimeout, ReadFailure, WriteTimeout, WriteFailure, AlreadyExists
from cassandra import OperationTimedOut, ReadTimeout, ReadFailure, WriteTimeout, WriteFailure, AlreadyExists, \
InvalidRequest
from cassandra.cluster import Cluster
from cassandra.protocol import ConfigurationException
from cassandra.policies import RoundRobinPolicy
@@ -411,7 +412,7 @@ def execute_until_pass(session, query):
while tries < 100:
try:
return session.execute(query)
except (ConfigurationException, AlreadyExists):
except (ConfigurationException, AlreadyExists, InvalidRequest):
log.warn("Received already exists from query {0} not exiting".format(query))
# keyspace/table was already created/dropped
return

View File

@@ -322,8 +322,6 @@ class TimeoutTimerTest(unittest.TestCase):
"""
Setup sessions and pause node1
"""
self.cluster = Cluster(protocol_version=PROTOCOL_VERSION)
self.session = self.cluster.connect()
# self.node1, self.node2, self.node3 = get_cluster().nodes.values()
self.node1 = get_node(1)

View File

@@ -650,5 +650,5 @@ class LoadBalancingPolicyTests(unittest.TestCase):
self.fail()
except NoHostAvailable:
pass
cluster.shutdown()
finally:
cluster.shutdown()

View File

@@ -140,7 +140,8 @@ class SchemaTests(unittest.TestCase):
self.check_and_wait_for_agreement(session, rs, False)
rs = session.execute("DROP KEYSPACE test_schema_disagreement")
self.check_and_wait_for_agreement(session, rs, False)
cluster.shutdown()
# These should have schema agreement
cluster = Cluster(protocol_version=PROTOCOL_VERSION, max_schema_agreement_wait=100)
session = cluster.connect()

View File

@@ -836,7 +836,9 @@ class ClusterTests(unittest.TestCase):
rr1 = ExecutionProfile(load_balancing_policy=RoundRobinPolicy())
exec_profiles = {'rr1': rr1}
with Cluster(execution_profiles=exec_profiles) as cluster:
session = cluster.connect()
session = cluster.connect(wait_for_all_pools=True)
self.assertGreater(len(cluster.metadata.all_hosts()), 1, "We only have one host connected at this point")
rr1_clone = session.execution_profile_clone_update('rr1', row_factory=tuple_factory)
cluster.add_execution_profile("rr1_clone", rr1_clone)
rr1_queried_hosts = set()
@@ -918,10 +920,11 @@ class ClusterTests(unittest.TestCase):
for i in range(max_retry_count):
start = time.time()
try:
self.assertRaises(cassandra.OperationTimedOut, cluster.add_execution_profile, 'node2',
self.assertRaises(cassandra.OperationTimedOut, cluster.add_execution_profile,
'profile_{0}'.format(i),
node2, pool_wait_timeout=sys.float_info.min)
break
except Exception:
except AssertionError:
end = time.time()
self.assertAlmostEqual(start, end, 1)
else:
@@ -1199,7 +1202,6 @@ class BetaProtocolTest(unittest.TestCase):
cluster.connect()
except Exception as e:
self.fail("Unexpected error encountered {0}".format(e.message))
cluster.shutdown()
@protocolv5
def test_valid_protocol_version_beta_options_connect(self):

View File

@@ -143,6 +143,8 @@ class MetricsTests(unittest.TestCase):
self.assertTrue(results)
# Stop node gracefully
# Sometimes this commands continues with the other nodes having not noticed
# 1 is down, and a Timeout error is returned instead of an Unavailable
get_node(1).stop(wait=True, wait_other_notice=True)
try:

View File

@@ -142,14 +142,6 @@ class UnmarshalTest(unittest.TestCase):
# int, tuple(sign, digits, exp), float
converted_types = (10001, (0, (1, 0, 0, 0, 0, 1), -3), 100.1, -87.629798)
if sys.version_info < (2, 7):
# Decimal in Python 2.6 does not accept floats for lossless initialization
# Just verifying expected exception here
f = converted_types[-1]
self.assertIsInstance(f, float)
self.assertRaises(TypeError, DecimalType.to_binary, f, ProtocolVersion.MAX_SUPPORTED)
converted_types = converted_types[:-1]
for proto_ver in range(1, ProtocolVersion.MAX_SUPPORTED + 1):
for n in converted_types:
expected = Decimal(n)