IMPALA-7067: deflake test_cancellation Tweak the query so that it still runs for a long time but can cancel the fragment quicker instead of being stuck in a long sleep() call.
Change-Id: I0c90d4f5c277f7b0d5561637944b454f7a44c76e Reviewed-on: http://gerrit.cloudera.org:8080/10499 Reviewed-by: Tim Armstrong <[email protected]> Tested-by: Tim Armstrong <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/impala/repo Commit: http://git-wip-us.apache.org/repos/asf/impala/commit/0e7b0759 Tree: http://git-wip-us.apache.org/repos/asf/impala/tree/0e7b0759 Diff: http://git-wip-us.apache.org/repos/asf/impala/diff/0e7b0759 Branch: refs/heads/2.x Commit: 0e7b075923cbecce4db2fd2e4fa3edf63afef06f Parents: 1ba8581 Author: Tim Armstrong <[email protected]> Authored: Wed May 23 21:56:14 2018 -0700 Committer: Impala Public Jenkins <[email protected]> Committed: Fri May 25 23:17:17 2018 +0000 ---------------------------------------------------------------------- tests/shell/test_shell_commandline.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/impala/blob/0e7b0759/tests/shell/test_shell_commandline.py ---------------------------------------------------------------------- diff --git a/tests/shell/test_shell_commandline.py b/tests/shell/test_shell_commandline.py index e1a4b61..94722e4 100644 --- a/tests/shell/test_shell_commandline.py +++ b/tests/shell/test_shell_commandline.py @@ -318,9 +318,12 @@ class TestImpalaShell(ImpalaTestSuite): assert 0 == impalad_service.get_num_in_flight_queries() def test_cancellation(self): - """Test cancellation (Ctrl+C event).""" - args = '-q "select sleep(100000)"' - p = ImpalaShell(args) + """Test cancellation (Ctrl+C event). Run a query that sleeps 10ms per row so will run + for 110s if not cancelled, but will detect cancellation quickly because of the small + batch size.""" + query = "set num_nodes=1; set mt_dop=1; set batch_size=1; \ + select sleep(10) from functional_parquet.alltypesagg" + p = ImpalaShell('-q "{0}"'.format(query)) sleep(6) os.kill(p.pid(), signal.SIGINT) result = p.get_result()
