Merge pull request #719 from datastax/python-jenkins-fixes
Fixed some failing tests in Jenkins
This commit is contained in:
@@ -28,7 +28,8 @@ from threading import Event
|
|||||||
from subprocess import call
|
from subprocess import call
|
||||||
from itertools import groupby
|
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.cluster import Cluster
|
||||||
from cassandra.protocol import ConfigurationException
|
from cassandra.protocol import ConfigurationException
|
||||||
from cassandra.policies import RoundRobinPolicy
|
from cassandra.policies import RoundRobinPolicy
|
||||||
@@ -411,7 +412,7 @@ def execute_until_pass(session, query):
|
|||||||
while tries < 100:
|
while tries < 100:
|
||||||
try:
|
try:
|
||||||
return session.execute(query)
|
return session.execute(query)
|
||||||
except (ConfigurationException, AlreadyExists):
|
except (ConfigurationException, AlreadyExists, InvalidRequest):
|
||||||
log.warn("Received already exists from query {0} not exiting".format(query))
|
log.warn("Received already exists from query {0} not exiting".format(query))
|
||||||
# keyspace/table was already created/dropped
|
# keyspace/table was already created/dropped
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -322,8 +322,6 @@ class TimeoutTimerTest(unittest.TestCase):
|
|||||||
"""
|
"""
|
||||||
Setup sessions and pause node1
|
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, self.node2, self.node3 = get_cluster().nodes.values()
|
||||||
self.node1 = get_node(1)
|
self.node1 = get_node(1)
|
||||||
|
|||||||
@@ -650,5 +650,5 @@ class LoadBalancingPolicyTests(unittest.TestCase):
|
|||||||
self.fail()
|
self.fail()
|
||||||
except NoHostAvailable:
|
except NoHostAvailable:
|
||||||
pass
|
pass
|
||||||
|
finally:
|
||||||
cluster.shutdown()
|
cluster.shutdown()
|
||||||
|
|||||||
@@ -140,7 +140,8 @@ class SchemaTests(unittest.TestCase):
|
|||||||
self.check_and_wait_for_agreement(session, rs, False)
|
self.check_and_wait_for_agreement(session, rs, False)
|
||||||
rs = session.execute("DROP KEYSPACE test_schema_disagreement")
|
rs = session.execute("DROP KEYSPACE test_schema_disagreement")
|
||||||
self.check_and_wait_for_agreement(session, rs, False)
|
self.check_and_wait_for_agreement(session, rs, False)
|
||||||
|
cluster.shutdown()
|
||||||
|
|
||||||
# These should have schema agreement
|
# These should have schema agreement
|
||||||
cluster = Cluster(protocol_version=PROTOCOL_VERSION, max_schema_agreement_wait=100)
|
cluster = Cluster(protocol_version=PROTOCOL_VERSION, max_schema_agreement_wait=100)
|
||||||
session = cluster.connect()
|
session = cluster.connect()
|
||||||
|
|||||||
@@ -836,7 +836,9 @@ class ClusterTests(unittest.TestCase):
|
|||||||
rr1 = ExecutionProfile(load_balancing_policy=RoundRobinPolicy())
|
rr1 = ExecutionProfile(load_balancing_policy=RoundRobinPolicy())
|
||||||
exec_profiles = {'rr1': rr1}
|
exec_profiles = {'rr1': rr1}
|
||||||
with Cluster(execution_profiles=exec_profiles) as cluster:
|
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)
|
rr1_clone = session.execution_profile_clone_update('rr1', row_factory=tuple_factory)
|
||||||
cluster.add_execution_profile("rr1_clone", rr1_clone)
|
cluster.add_execution_profile("rr1_clone", rr1_clone)
|
||||||
rr1_queried_hosts = set()
|
rr1_queried_hosts = set()
|
||||||
@@ -918,10 +920,11 @@ class ClusterTests(unittest.TestCase):
|
|||||||
for i in range(max_retry_count):
|
for i in range(max_retry_count):
|
||||||
start = time.time()
|
start = time.time()
|
||||||
try:
|
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)
|
node2, pool_wait_timeout=sys.float_info.min)
|
||||||
break
|
break
|
||||||
except Exception:
|
except AssertionError:
|
||||||
end = time.time()
|
end = time.time()
|
||||||
self.assertAlmostEqual(start, end, 1)
|
self.assertAlmostEqual(start, end, 1)
|
||||||
else:
|
else:
|
||||||
@@ -1199,7 +1202,6 @@ class BetaProtocolTest(unittest.TestCase):
|
|||||||
cluster.connect()
|
cluster.connect()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.fail("Unexpected error encountered {0}".format(e.message))
|
self.fail("Unexpected error encountered {0}".format(e.message))
|
||||||
cluster.shutdown()
|
|
||||||
|
|
||||||
@protocolv5
|
@protocolv5
|
||||||
def test_valid_protocol_version_beta_options_connect(self):
|
def test_valid_protocol_version_beta_options_connect(self):
|
||||||
|
|||||||
@@ -143,6 +143,8 @@ class MetricsTests(unittest.TestCase):
|
|||||||
self.assertTrue(results)
|
self.assertTrue(results)
|
||||||
|
|
||||||
# Stop node gracefully
|
# 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)
|
get_node(1).stop(wait=True, wait_other_notice=True)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -142,14 +142,6 @@ class UnmarshalTest(unittest.TestCase):
|
|||||||
# int, tuple(sign, digits, exp), float
|
# int, tuple(sign, digits, exp), float
|
||||||
converted_types = (10001, (0, (1, 0, 0, 0, 0, 1), -3), 100.1, -87.629798)
|
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 proto_ver in range(1, ProtocolVersion.MAX_SUPPORTED + 1):
|
||||||
for n in converted_types:
|
for n in converted_types:
|
||||||
expected = Decimal(n)
|
expected = Decimal(n)
|
||||||
|
|||||||
Reference in New Issue
Block a user