IMPALA-7238: Use custom timeout for create unique database test_kudu.TestCreateExternalTables() saw a timeout when creating the unique database for its tests.
__unique_conn() opens a connection, creates a unique database, then returns another connection in that database. It takes a custom timeout argument, but the timeout is only for the returned connection. The first connection to create the unique database uses the default timeout of 45 seconds. This patch changes the first connection to use the custom timeout. For Kudu tests, this is 5 minutes rather than 45 seconds. Change-Id: I4f2beb5bc027a4bb44e854bf1dd8919807a92ea0 Reviewed-on: http://gerrit.cloudera.org:8080/10862 Reviewed-by: Joe McDonnell <[email protected]> Tested-by: Impala Public Jenkins <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/impala/repo Commit: http://git-wip-us.apache.org/repos/asf/impala/commit/6887fc21 Tree: http://git-wip-us.apache.org/repos/asf/impala/tree/6887fc21 Diff: http://git-wip-us.apache.org/repos/asf/impala/diff/6887fc21 Branch: refs/heads/master Commit: 6887fc2190da26af2ae5b6bd3b90e5b22d20c963 Parents: 558fa14 Author: Joe McDonnell <[email protected]> Authored: Tue Jul 3 16:20:15 2018 -0700 Committer: Joe McDonnell <[email protected]> Committed: Tue Jul 17 16:45:34 2018 +0000 ---------------------------------------------------------------------- tests/conftest.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/impala/blob/6887fc21/tests/conftest.py ---------------------------------------------------------------------- diff --git a/tests/conftest.py b/tests/conftest.py index fe6b332..a1f1859 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -356,7 +356,7 @@ def conn(request): with __unique_conn(db_name=db_name, timeout=timeout) as conn: yield conn else: - with __auto_closed_conn(db_name=db_name) as conn: + with __auto_closed_conn(db_name=db_name, timeout=timeout) as conn: yield conn @@ -388,7 +388,7 @@ def __unique_conn(db_name=None, timeout=DEFAULT_CONN_TIMEOUT): """ if not db_name: db_name = choice(ascii_lowercase) + "".join(sample(ascii_lowercase + digits, 5)) - with __auto_closed_conn() as conn: + with __auto_closed_conn(timeout=timeout) as conn: with __auto_closed_cursor(conn) as cur: cur.execute("CREATE DATABASE %s" % db_name) with __auto_closed_conn(db_name=db_name, timeout=timeout) as conn:
