mirror of
https://github.com/apache/impala.git
synced 2026-01-05 03:01:02 -05:00
A crucial comparison was between time values with different units. Tests didn't catch this because they only confirmed that sessions were timed out within the correct time, not that they were *not* timed out early. Change-Id: Ia8c57d3d70e4702996d0225b167142b7bf88d236 Reviewed-on: http://gerrit.ent.cloudera.com:8080/1926 Tested-by: jenkins Reviewed-by: Henry Robinson <henry@cloudera.com>
42 lines
1.7 KiB
Python
Executable File
42 lines
1.7 KiB
Python
Executable File
#!/usr/bin/env python
|
|
# Copyright (c) 2012 Cloudera, Inc. All rights reserved.
|
|
#
|
|
# Licensed 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.
|
|
#
|
|
# Tests for query expiration.
|
|
|
|
import pytest
|
|
import threading
|
|
from tests.common.custom_cluster_test_suite import CustomClusterTestSuite
|
|
from tests.common.custom_cluster_test_suite import NUM_SUBSCRIBERS, CLUSTER_SIZE
|
|
from time import sleep, time
|
|
from tests.beeswax.impala_beeswax import ImpalaBeeswaxException
|
|
|
|
class TestSessionExpiration(CustomClusterTestSuite):
|
|
"""Tests query expiration logic"""
|
|
|
|
@pytest.mark.execute_serially
|
|
@CustomClusterTestSuite.with_args("--idle_session_timeout=6")
|
|
def test_session_expiration(self, vector):
|
|
impalad = self.cluster.get_any_impalad()
|
|
num_expired = impalad.service.get_metric_value("impala-server.num-sessions-expired")
|
|
client = impalad.service.create_beeswax_client()
|
|
# Sleep for half the expiration time to confirm that the session is not expired early
|
|
# (see IMPALA-838)
|
|
sleep(3)
|
|
assert num_expired == impalad.service.get_metric_value(
|
|
"impala-server.num-sessions-expired")
|
|
# Wait for session expiration
|
|
impalad.service.wait_for_metric_value(
|
|
"impala-server.num-sessions-expired", num_expired + 1)
|