From 0bf4ee1fc68ea366a5288d945cda13db4961b3dc Mon Sep 17 00:00:00 2001 From: Irina Kaplounova Date: Sun, 17 Aug 2014 13:43:26 -0700 Subject: [PATCH 1/2] PYTHON-118: Set 60 sec timeout for SELECT and CREATE TYPE queries to avoid test failure on slow systems. --- tests/integration/standard/test_udts.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/integration/standard/test_udts.py b/tests/integration/standard/test_udts.py index 3bb42a4e..3b109e02 100644 --- a/tests/integration/standard/test_udts.py +++ b/tests/integration/standard/test_udts.py @@ -275,6 +275,7 @@ class TypeTests(unittest.TestCase): raise unittest.SkipTest("The tuple type was introduced in Cassandra 2.1") MAX_TEST_LENGTH = 16384 + timeout = 60 c = Cluster(protocol_version=PROTOCOL_VERSION) s = c.connect() @@ -283,8 +284,9 @@ class TypeTests(unittest.TestCase): WITH replication = { 'class' : 'SimpleStrategy', 'replication_factor': '1'}""") s.set_keyspace("test_udt_sizes") - # create the seed udt - s.execute("CREATE TYPE lengthy_udt ({})".format(', '.join(['v_{} int'.format(i) for i in range(MAX_TEST_LENGTH)]))) + # create the seed udt, increase timeout to avoid the query failure on slow systems + s.execute("CREATE TYPE lengthy_udt ({})".format(', '.join(['v_{} int'.format(i) + for i in range(MAX_TEST_LENGTH)])), timeout=timeout) # create a table with multiple sizes of nested udts # no need for all nested types, only a spot checked few and the largest one @@ -305,8 +307,8 @@ class TypeTests(unittest.TestCase): # write udt s.execute("INSERT INTO mytable (k, v) VALUES (0, %s)", (created_udt,)) - # verify udt was written and read correctly - result = s.execute("SELECT v FROM mytable WHERE k=0")[0] + # verify udt was written and read correctly, increase timeout to avoid the query failure on slow systems + result = s.execute("SELECT v FROM mytable WHERE k=0", timeout=timeout)[0] self.assertEqual(created_udt, result.v) def nested_udt_helper(self, udts, i): From c323d4ba7079b83c8b32dfcd53ed079d95ae2429 Mon Sep 17 00:00:00 2001 From: Irina Kaplounova Date: Mon, 18 Aug 2014 09:53:51 -0700 Subject: [PATCH 2/2] PYTHON-118: Set 60 sec timeout for SELECT and CREATE TYPE queries to avoid test failure on slow systems. --- tests/integration/standard/test_udts.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/integration/standard/test_udts.py b/tests/integration/standard/test_udts.py index 3b109e02..29c44536 100644 --- a/tests/integration/standard/test_udts.py +++ b/tests/integration/standard/test_udts.py @@ -275,7 +275,7 @@ class TypeTests(unittest.TestCase): raise unittest.SkipTest("The tuple type was introduced in Cassandra 2.1") MAX_TEST_LENGTH = 16384 - timeout = 60 + EXTENDED_QUERY_TIMEOUT = 60 c = Cluster(protocol_version=PROTOCOL_VERSION) s = c.connect() @@ -285,8 +285,9 @@ class TypeTests(unittest.TestCase): s.set_keyspace("test_udt_sizes") # create the seed udt, increase timeout to avoid the query failure on slow systems - s.execute("CREATE TYPE lengthy_udt ({})".format(', '.join(['v_{} int'.format(i) - for i in range(MAX_TEST_LENGTH)])), timeout=timeout) + s.execute("CREATE TYPE lengthy_udt ({})" + .format(', '.join(['v_{} int'.format(i) + for i in range(MAX_TEST_LENGTH)])), timeout=EXTENDED_QUERY_TIMEOUT) # create a table with multiple sizes of nested udts # no need for all nested types, only a spot checked few and the largest one @@ -308,7 +309,7 @@ class TypeTests(unittest.TestCase): s.execute("INSERT INTO mytable (k, v) VALUES (0, %s)", (created_udt,)) # verify udt was written and read correctly, increase timeout to avoid the query failure on slow systems - result = s.execute("SELECT v FROM mytable WHERE k=0", timeout=timeout)[0] + result = s.execute("SELECT v FROM mytable WHERE k=0", timeout=EXTENDED_QUERY_TIMEOUT)[0] self.assertEqual(created_udt, result.v) def nested_udt_helper(self, udts, i):