misc fixes for jenkins

This commit is contained in:
GregBestland
2016-08-02 09:20:21 -05:00
parent a3bd73855d
commit d244ece986
3 changed files with 29 additions and 26 deletions

View File

@@ -37,7 +37,7 @@ class SchemaTests(unittest.TestCase):
@classmethod @classmethod
def setup_class(cls): def setup_class(cls):
cls.cluster = Cluster(protocol_version=PROTOCOL_VERSION) cls.cluster = Cluster(protocol_version=PROTOCOL_VERSION)
cls.session = cls.cluster.connect() cls.session = cls.cluster.connect(wait_for_all_pools=True)
@classmethod @classmethod
def teardown_class(cls): def teardown_class(cls):
@@ -98,7 +98,7 @@ class SchemaTests(unittest.TestCase):
""" """
cluster = Cluster(protocol_version=PROTOCOL_VERSION) cluster = Cluster(protocol_version=PROTOCOL_VERSION)
session = cluster.connect() session = cluster.connect(wait_for_all_pools=True)
for i in range(30): for i in range(30):
try: try:
@@ -131,7 +131,7 @@ class SchemaTests(unittest.TestCase):
""" """
# This should yield a schema disagreement # This should yield a schema disagreement
cluster = Cluster(protocol_version=PROTOCOL_VERSION, max_schema_agreement_wait=0.001) cluster = Cluster(protocol_version=PROTOCOL_VERSION, max_schema_agreement_wait=0.001)
session = cluster.connect() session = cluster.connect(wait_for_all_pools=True)
rs = session.execute("CREATE KEYSPACE test_schema_disagreement WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1}") rs = session.execute("CREATE KEYSPACE test_schema_disagreement WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1}")
self.check_and_wait_for_agreement(session, rs, False) self.check_and_wait_for_agreement(session, rs, False)

View File

@@ -406,15 +406,18 @@ class PreparedStatementArgTest(unittest.TestCase):
clus = Cluster( clus = Cluster(
load_balancing_policy=white_list, load_balancing_policy=white_list,
protocol_version=PROTOCOL_VERSION, prepare_on_all_hosts=False, reprepare_on_up=False) protocol_version=PROTOCOL_VERSION, prepare_on_all_hosts=False, reprepare_on_up=False)
session = clus.connect() try:
mock_handler = MockLoggingHandler() session = clus.connect(wait_for_all_pools=True)
logger = logging.getLogger(cluster.__name__) mock_handler = MockLoggingHandler()
logger.addHandler(mock_handler) logger = logging.getLogger(cluster.__name__)
select_statement = session.prepare("SELECT * FROM system.local") logger.addHandler(mock_handler)
session.execute(select_statement) select_statement = session.prepare("SELECT * FROM system.local")
session.execute(select_statement) session.execute(select_statement)
session.execute(select_statement) session.execute(select_statement)
self.assertEqual(2, mock_handler.get_message_count('debug', "Re-preparing")) session.execute(select_statement)
self.assertEqual(2, mock_handler.get_message_count('debug', "Re-preparing"))
finally:
clus.shutdown()
class PrintStatementTests(unittest.TestCase): class PrintStatementTests(unittest.TestCase):

View File

@@ -56,7 +56,7 @@ class UDTTests(BasicSegregatedKeyspaceUnitTestCase):
""" """
c = Cluster(protocol_version=PROTOCOL_VERSION) c = Cluster(protocol_version=PROTOCOL_VERSION)
s = c.connect(self.keyspace_name) s = c.connect(self.keyspace_name, wait_for_all_pools=True)
s.execute("CREATE TYPE user (age int, name text)") s.execute("CREATE TYPE user (age int, name text)")
s.execute("CREATE TABLE mytable (a int PRIMARY KEY, b frozen<user>)") s.execute("CREATE TABLE mytable (a int PRIMARY KEY, b frozen<user>)")
@@ -100,7 +100,7 @@ class UDTTests(BasicSegregatedKeyspaceUnitTestCase):
""" """
c = Cluster(protocol_version=PROTOCOL_VERSION) c = Cluster(protocol_version=PROTOCOL_VERSION)
s = c.connect() s = c.connect(wait_for_all_pools=True)
s.execute(""" s.execute("""
CREATE KEYSPACE udt_test_register_before_connecting CREATE KEYSPACE udt_test_register_before_connecting
@@ -128,7 +128,7 @@ class UDTTests(BasicSegregatedKeyspaceUnitTestCase):
c.register_user_type("udt_test_register_before_connecting", "user", User1) c.register_user_type("udt_test_register_before_connecting", "user", User1)
c.register_user_type("udt_test_register_before_connecting2", "user", User2) c.register_user_type("udt_test_register_before_connecting2", "user", User2)
s = c.connect() s = c.connect(wait_for_all_pools=True)
s.set_keyspace("udt_test_register_before_connecting") s.set_keyspace("udt_test_register_before_connecting")
s.execute("INSERT INTO mytable (a, b) VALUES (%s, %s)", (0, User1(42, 'bob'))) s.execute("INSERT INTO mytable (a, b) VALUES (%s, %s)", (0, User1(42, 'bob')))
@@ -158,7 +158,7 @@ class UDTTests(BasicSegregatedKeyspaceUnitTestCase):
""" """
c = Cluster(protocol_version=PROTOCOL_VERSION) c = Cluster(protocol_version=PROTOCOL_VERSION)
s = c.connect(self.keyspace_name) s = c.connect(self.keyspace_name, wait_for_all_pools=True)
s.execute("CREATE TYPE user (age int, name text)") s.execute("CREATE TYPE user (age int, name text)")
s.execute("CREATE TABLE mytable (a int PRIMARY KEY, b frozen<user>)") s.execute("CREATE TABLE mytable (a int PRIMARY KEY, b frozen<user>)")
@@ -202,7 +202,7 @@ class UDTTests(BasicSegregatedKeyspaceUnitTestCase):
""" """
c = Cluster(protocol_version=PROTOCOL_VERSION) c = Cluster(protocol_version=PROTOCOL_VERSION)
s = c.connect(self.keyspace_name) s = c.connect(self.keyspace_name, wait_for_all_pools=True)
s.execute("CREATE TYPE user (age int, name text)") s.execute("CREATE TYPE user (age int, name text)")
User = namedtuple('user', ('age', 'name')) User = namedtuple('user', ('age', 'name'))
@@ -252,7 +252,7 @@ class UDTTests(BasicSegregatedKeyspaceUnitTestCase):
""" """
c = Cluster(protocol_version=PROTOCOL_VERSION) c = Cluster(protocol_version=PROTOCOL_VERSION)
s = c.connect(self.keyspace_name) s = c.connect(self.keyspace_name, wait_for_all_pools=True)
s.execute("CREATE TYPE user (a text, b int, c uuid, d blob)") s.execute("CREATE TYPE user (a text, b int, c uuid, d blob)")
User = namedtuple('user', ('a', 'b', 'c', 'd')) User = namedtuple('user', ('a', 'b', 'c', 'd'))
@@ -282,7 +282,7 @@ class UDTTests(BasicSegregatedKeyspaceUnitTestCase):
""" """
c = Cluster(protocol_version=PROTOCOL_VERSION) c = Cluster(protocol_version=PROTOCOL_VERSION)
s = c.connect(self.keyspace_name) s = c.connect(self.keyspace_name, wait_for_all_pools=True)
MAX_TEST_LENGTH = 254 MAX_TEST_LENGTH = 254
@@ -366,7 +366,7 @@ class UDTTests(BasicSegregatedKeyspaceUnitTestCase):
""" """
c = Cluster(protocol_version=PROTOCOL_VERSION) c = Cluster(protocol_version=PROTOCOL_VERSION)
s = c.connect(self.keyspace_name) s = c.connect(self.keyspace_name, wait_for_all_pools=True)
s.row_factory = dict_factory s.row_factory = dict_factory
MAX_NESTING_DEPTH = 16 MAX_NESTING_DEPTH = 16
@@ -397,7 +397,7 @@ class UDTTests(BasicSegregatedKeyspaceUnitTestCase):
""" """
c = Cluster(protocol_version=PROTOCOL_VERSION) c = Cluster(protocol_version=PROTOCOL_VERSION)
s = c.connect(self.keyspace_name) s = c.connect(self.keyspace_name, wait_for_all_pools=True)
s.row_factory = dict_factory s.row_factory = dict_factory
MAX_NESTING_DEPTH = 16 MAX_NESTING_DEPTH = 16
@@ -437,7 +437,7 @@ class UDTTests(BasicSegregatedKeyspaceUnitTestCase):
""" """
c = Cluster(protocol_version=PROTOCOL_VERSION) c = Cluster(protocol_version=PROTOCOL_VERSION)
s = c.connect(self.keyspace_name) s = c.connect(self.keyspace_name, wait_for_all_pools=True)
s.row_factory = dict_factory s.row_factory = dict_factory
MAX_NESTING_DEPTH = 16 MAX_NESTING_DEPTH = 16
@@ -468,7 +468,7 @@ class UDTTests(BasicSegregatedKeyspaceUnitTestCase):
""" """
c = Cluster(protocol_version=PROTOCOL_VERSION) c = Cluster(protocol_version=PROTOCOL_VERSION)
s = c.connect(self.keyspace_name) s = c.connect(self.keyspace_name, wait_for_all_pools=True)
User = namedtuple('user', ('age', 'name')) User = namedtuple('user', ('age', 'name'))
with self.assertRaises(UserTypeDoesNotExist): with self.assertRaises(UserTypeDoesNotExist):
@@ -488,7 +488,7 @@ class UDTTests(BasicSegregatedKeyspaceUnitTestCase):
""" """
c = Cluster(protocol_version=PROTOCOL_VERSION) c = Cluster(protocol_version=PROTOCOL_VERSION)
s = c.connect(self.keyspace_name) s = c.connect(self.keyspace_name, wait_for_all_pools=True)
# create UDT # create UDT
alpha_type_list = [] alpha_type_list = []
@@ -533,7 +533,7 @@ class UDTTests(BasicSegregatedKeyspaceUnitTestCase):
""" """
c = Cluster(protocol_version=PROTOCOL_VERSION) c = Cluster(protocol_version=PROTOCOL_VERSION)
s = c.connect(self.keyspace_name) s = c.connect(self.keyspace_name, wait_for_all_pools=True)
# create UDT # create UDT
alpha_type_list = [] alpha_type_list = []
@@ -600,7 +600,7 @@ class UDTTests(BasicSegregatedKeyspaceUnitTestCase):
raise unittest.SkipTest("Support for nested collections was introduced in Cassandra 2.1.3") raise unittest.SkipTest("Support for nested collections was introduced in Cassandra 2.1.3")
c = Cluster(protocol_version=PROTOCOL_VERSION) c = Cluster(protocol_version=PROTOCOL_VERSION)
s = c.connect(self.keyspace_name) s = c.connect(self.keyspace_name, wait_for_all_pools=True)
s.encoder.mapping[tuple] = s.encoder.cql_encode_tuple s.encoder.mapping[tuple] = s.encoder.cql_encode_tuple
name = self._testMethodName name = self._testMethodName