mirror of
https://github.com/apache/impala.git
synced 2025-12-19 09:58:28 -05:00
This is the final patch to move all Impala e2e and custom cluster tests to use HS2 protocol by default. Only beeswax-specific test remains testing against beeswax protocol by default. We can remove them once Impala officially remove beeswax support. HS2 error message formatting in impala-hs2-server.cc is adjusted a bit to match with formatting in impala-beeswax-server.cc. Move TestWebPageAndCloseSession from webserver/test_web_pages.py to custom_cluster/test_web_pages.py to disable glog log buffering. Testing: - Pass exhaustive tests, except for some known and unrelated flaky tests. Change-Id: I42e9ceccbba1e6853f37e68f106265d163ccae28 Reviewed-on: http://gerrit.cloudera.org:8080/22845 Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com> Tested-by: Jason Fehr <jfehr@cloudera.com>
87 lines
3.3 KiB
Python
87 lines
3.3 KiB
Python
# Licensed to the Apache Software Foundation (ASF) under one
|
|
# or more contributor license agreements. See the NOTICE file
|
|
# distributed with this work for additional information
|
|
# regarding copyright ownership. The ASF licenses this file
|
|
# to you under the Apache License, Version 2.0 (the
|
|
# "License"); you may not use this file except in compliance
|
|
# with the License. You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing,
|
|
# software distributed under the License is distributed on an
|
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
# KIND, either express or implied. See the License for the
|
|
# specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
from __future__ import absolute_import, division, print_function
|
|
import pytest
|
|
|
|
from threading import Thread
|
|
from tests.common.custom_cluster_test_suite import CustomClusterTestSuite
|
|
|
|
# This custom cluster test exercises the behavior of the front end thrift
|
|
# server on how a new client connection request is handled, after the maximum
|
|
# number of front end service threads (--fe_service_threads) has been
|
|
# allocated. If "--accepted_client_cnxn_timeout" > 0, new connection
|
|
# requests are rejected if they wait in the accepted queue for more than the
|
|
# the specified timeout.
|
|
# See IMPALA-7800.
|
|
|
|
|
|
class TestFrontendConnectionLimit(CustomClusterTestSuite):
|
|
|
|
@classmethod
|
|
def add_test_dimensions(cls):
|
|
super(TestFrontendConnectionLimit, cls).add_test_dimensions()
|
|
|
|
@classmethod
|
|
def need_default_clients(cls):
|
|
"""Must not create default clients because it will interfere with test methods.
|
|
"""
|
|
return False
|
|
|
|
def _connect_and_query(self, query, impalad):
|
|
with impalad.service.create_hs2_client() as client:
|
|
self.execute_query_expect_success(client, query)
|
|
|
|
@pytest.mark.execute_serially
|
|
@CustomClusterTestSuite.with_args(
|
|
impalad_args="--fe_service_threads=1 --accepted_client_cnxn_timeout=0")
|
|
def test_no_connection_is_rejected(self):
|
|
""" IMPALA-7800: New connection request should not be rejected if
|
|
--accepted_client_cnxn_timeout=0"""
|
|
|
|
query = "select sleep(2000)"
|
|
impalad = self.cluster.get_any_impalad()
|
|
q1 = Thread(target=self._connect_and_query, args=(query, impalad,))
|
|
q2 = Thread(target=self._connect_and_query, args=(query, impalad,))
|
|
q1.start()
|
|
q2.start()
|
|
q1.join()
|
|
q2.join()
|
|
|
|
@pytest.mark.execute_serially
|
|
@CustomClusterTestSuite.with_args(
|
|
impalad_args="--fe_service_threads=1 --accepted_client_cnxn_timeout=5000")
|
|
def test_server_busy(self):
|
|
""" IMPALA-7800: Reject new incoming connections if --accepted_client_cnxn_timeout > 0
|
|
and the request spent too much time waiting in the accepted queue."""
|
|
|
|
client = self.create_impala_client()
|
|
client.execute_async("select sleep(7000)")
|
|
|
|
# This step should fail to open a session.
|
|
# create_impala_client() does not throw an error on connection failure
|
|
# The only way to detect the connection is invalid is to perform a
|
|
# query in it
|
|
client1 = self.create_impala_client()
|
|
caught_exception = False
|
|
try:
|
|
client1.execute("select sleep(8000)")
|
|
except Exception:
|
|
caught_exception = True
|
|
client.close()
|
|
assert caught_exception, 'Query on client1 did not fail as expected'
|