Repository: incubator-impala Updated Branches: refs/heads/master 067af1957 -> a1b035a25
IMPALA-3600: Add missing admission control tests * -require_username (not strictly admission control related but it came up in the context of RM). * Coverage of failure cases: The handling of the full queue case wasn't being verified. This changes existing stress test to expect a specific message when the queue is full. * Requesting MAXINT memory, which previously led to an overflow in the pool-level mem tracker accounting. This does not yet address: * Changing pool cfg while running * Verify profile string for queued reason This is just a minimal incremental change to get additional coverage. Right now, many of the tests rely on some pre-defined configuration files which is cumbersome. In the future, we plan on refreshing the configuration story at which point we should also build more general test infrastructure for easily testing different configurations. Change-Id: I6682b15a5caac5824384c4b48a7b40afa2548954 Reviewed-on: http://gerrit.cloudera.org:8080/3272 Reviewed-by: Dan Hecht <[email protected]> Tested-by: Matthew Jacobs <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/incubator-impala/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-impala/commit/a1b035a2 Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/a1b035a2 Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/a1b035a2 Branch: refs/heads/master Commit: a1b035a251f0c2e9674aa33543601c956e9bdd98 Parents: 067af19 Author: Matthew Jacobs <[email protected]> Authored: Tue May 24 16:38:27 2016 -0700 Committer: Tim Armstrong <[email protected]> Committed: Mon Jun 6 18:34:13 2016 -0700 ---------------------------------------------------------------------- .../custom_cluster/test_admission_controller.py | 32 ++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/a1b035a2/tests/custom_cluster/test_admission_controller.py ---------------------------------------------------------------------- diff --git a/tests/custom_cluster/test_admission_controller.py b/tests/custom_cluster/test_admission_controller.py index 2c5af7c..5baf35e 100644 --- a/tests/custom_cluster/test_admission_controller.py +++ b/tests/custom_cluster/test_admission_controller.py @@ -1,6 +1,7 @@ # Copyright (c) 2014 Cloudera, Inc. All rights reserved. # Tests admission control +import sys import pytest import threading import re @@ -248,6 +249,29 @@ class TestAdmissionController(TestAdmissionControllerBase, HS2TestSuite): @pytest.mark.execute_serially @CustomClusterTestSuite.with_args( + impalad_args=impalad_admission_ctrl_config_args("-require_username"), + statestored_args=_STATESTORED_ARGS) + def test_require_user(self): + open_session_req = TCLIService.TOpenSessionReq() + open_session_req.username = "" + open_session_resp = self.hs2_client.OpenSession(open_session_req) + TestAdmissionController.check_response(open_session_resp) + + try: + execute_statement_req = TCLIService.TExecuteStatementReq() + execute_statement_req.sessionHandle = open_session_resp.sessionHandle + execute_statement_req.statement = "select count(1) from functional.alltypes" + execute_statement_resp = self.hs2_client.ExecuteStatement(execute_statement_req) + TestAdmissionController.check_response(execute_statement_resp, + TCLIService.TStatusCode.ERROR_STATUS, "User must be specified") + finally: + close_req = TCLIService.TCloseSessionReq() + close_req.sessionHandle = open_session_resp.sessionHandle + TestAdmissionController.check_response(self.hs2_client.CloseSession(close_req)) + + + @pytest.mark.execute_serially + @CustomClusterTestSuite.with_args( impalad_args=impalad_admission_ctrl_flags(1, 1, 1234, 1024 * 1024 * 1024), statestored_args=_STATESTORED_ARGS) def test_trivial_coord_query_limits(self): @@ -502,7 +526,7 @@ class TestAdmissionControllerStress(TestAdmissionControllerBase): LOG.debug("Submitting query %s", self.query_num) self.query_handle = client.execute_async(query) except ImpalaBeeswaxException as e: - if "Rejected" in str(e): + if re.search("Rejected.*queue full", str(e)): LOG.debug("Rejected query %s", self.query_num) self.query_state = 'REJECTED' return @@ -642,7 +666,11 @@ class TestAdmissionControllerStress(TestAdmissionControllerBase): statestored_args=_STATESTORED_ARGS) def test_admission_controller_with_flags(self, vector): self.pool_name = 'default-pool' - self.run_admission_test(vector, {'request_pool': self.pool_name}) + # The pool has no mem resources set, so submitting queries with huge mem_limits + # should be fine. This exercises the code that does the per-pool memory + # accounting (see MemTracker::GetPoolMemReserved()) without actually being throttled. + self.run_admission_test(vector, {'request_pool': self.pool_name, + 'mem_limit': sys.maxint}) @pytest.mark.execute_serially @CustomClusterTestSuite.with_args(
