def test_queries_closed(self, vector):
    """Regression test for IMPALA-897."""
    args = ['-f', '{0}/test_close_queries.sql'.format(QUERY_FILE_PATH), '--quiet', '-B']
    # Execute the shell command async
    p = ImpalaShell(vector, args)

    impalad_service = ImpaladService(get_impalad_host_port(vector).split(':')[0])
    # The last query in the test SQL script will sleep for 10 seconds, so sleep
    # here for 5 seconds and verify the number of in-flight queries is 1.
    sleep(5)
    assert 1 == impalad_service.get_num_in_flight_queries()
    assert p.get_result().rc == 0
    assert 0 == impalad_service.get_num_in_flight_queries()
示例#2
0
  def test_queries_closed(self, vector):
    """Regression test for IMPALA-897."""
    args = ['-f', '{0}/test_close_queries.sql'.format(QUERY_FILE_PATH), '--quiet', '-B']
    # Execute the shell command async
    p = ImpalaShell(vector, args)

    impalad_service = ImpaladService(get_impalad_host_port(vector).split(':')[0])
    # The last query in the test SQL script will sleep for 10 seconds, so sleep
    # here for 5 seconds and verify the number of in-flight queries is 1.
    sleep(5)
    assert 1 == impalad_service.get_num_in_flight_queries()
    assert p.get_result().rc == 0
    assert 0 == impalad_service.get_num_in_flight_queries()
  def test_queries_closed(self):
    """Regression test for IMPALA-897."""
    args = '-f %s/test_close_queries.sql --quiet -B' % QUERY_FILE_PATH
    cmd = "%s %s" % (SHELL_CMD, args)
    # Execute the shell command async
    p = ImpalaShell(args)

    impalad_service = ImpaladService(IMPALAD.split(':')[0])
    # The last query in the test SQL script will sleep for 10 seconds, so sleep
    # here for 5 seconds and verify the number of in-flight queries is 1.
    sleep(5)
    assert 1 == impalad_service.get_num_in_flight_queries()
    assert p.get_result().rc == 0
    assert 0 == impalad_service.get_num_in_flight_queries()
  def test_queries_closed(self):
    """Regression test for IMPALA-897."""
    args = '-f %s/test_close_queries.sql --quiet -B' % QUERY_FILE_PATH
    cmd = "%s %s" % (SHELL_CMD, args)
    # Execute the shell command async
    p = ImpalaShell(args)

    impalad_service = ImpaladService(IMPALAD.split(':')[0])
    # The last query in the test SQL script will sleep for 10 seconds, so sleep
    # here for 5 seconds and verify the number of in-flight queries is 1.
    sleep(5)
    assert 1 == impalad_service.get_num_in_flight_queries()
    assert p.get_result().rc == 0
    assert 0 == impalad_service.get_num_in_flight_queries()
示例#5
0
    def test_ssl(self, vector):

        self._verify_negative_cases(vector)
        # TODO: This is really two different tests, but the custom cluster takes too long to
        # start. Make it so that custom clusters can be specified across test suites.
        self._validate_positive_cases(vector,
                                      "%s/server-cert.pem" % self.CERT_DIR)

        # No certificate checking: will accept any cert.
        self._validate_positive_cases(vector, )

        # Test cancelling a query
        impalad = ImpaladService(socket.getfqdn())
        assert impalad.wait_for_num_in_flight_queries(0)
        impalad.wait_for_metric_value(
            'impala-server.backend-num-queries-executing', 0)
        p = ImpalaShell(vector, args=["--ssl"])
        p.send_cmd("SET DEBUG_ACTION=0:OPEN:WAIT")
        p.send_cmd("select count(*) from functional.alltypes")
        # Wait until the query has been planned and started executing, at which point it
        # should be cancellable.
        impalad.wait_for_metric_value(
            'impala-server.backend-num-queries-executing', 1, timeout=60)

        LOG = logging.getLogger('test_client_ssl')
        LOG.info("Cancelling query")
        num_tries = 0
        # In practice, sending SIGINT to the shell process doesn't always seem to get caught
        # (and a search shows up some bugs in Python where SIGINT might be ignored). So retry
        # for 30s until one signal takes.
        while impalad.get_num_in_flight_queries() == 1:
            time.sleep(1)
            LOG.info("Sending signal...")
            os.kill(p.pid(), signal.SIGINT)
            num_tries += 1
            assert num_tries < 30, (
                "SIGINT was not caught by shell within 30s. Queries: " +
                json.dumps(impalad.get_queries_json(), indent=2))

        p.send_cmd("profile")
        result = p.get_result()

        print result.stderr
        assert "Query Status: Cancelled" in result.stdout
        assert impalad.wait_for_num_in_flight_queries(0)
示例#6
0
  def test_ssl(self, vector):
    # TODO: This is really two different tests, but the custom cluster takes too long to
    # start. Make it so that custom clusters can be specified across test suites.
    result = run_impala_shell_cmd("--ssl --ca_cert=%s/server-cert.pem -q 'select 1 + 2'"
                                  % self.CERT_DIR)
    for msg in [self.SSL_ENABLED, self.CONNECTED, self.FETCHED]:
      assert msg in result.stderr

    # No certificate checking: will accept any cert.
    result = run_impala_shell_cmd("--ssl -q 'select 1 + 2'")
    for msg in [self.SSL_ENABLED, self.CONNECTED, self.FETCHED]:
      assert msg in result.stderr

    # Test cancelling a query
    impalad = ImpaladService(socket.getfqdn())
    impalad.wait_for_num_in_flight_queries(0)
    p = ImpalaShell(args="--ssl")
    p.send_cmd("SET DEBUG_ACTION=0:OPEN:WAIT")
    p.send_cmd("select count(*) from functional.alltypes")
    impalad.wait_for_num_in_flight_queries(1)

    LOG = logging.getLogger('test_client_ssl')
    LOG.info("Cancelling query")
    num_tries = 0
    # In practice, sending SIGINT to the shell process doesn't always seem to get caught
    # (and a search shows up some bugs in Python where SIGINT might be ignored). So retry
    # for 30s until one signal takes.
    while impalad.get_num_in_flight_queries() == 1:
      time.sleep(1)
      LOG.info("Sending signal...")
      os.kill(p.pid(), signal.SIGINT)
      num_tries += 1
      assert num_tries < 30, "SIGINT was not caught by shell within 30s"

    p.send_cmd("profile")
    result = p.get_result()

    print result.stderr
    assert result.rc == 0
    assert "Query Status: Cancelled" in result.stdout
    assert impalad.wait_for_num_in_flight_queries(0)
示例#7
0
    def test_ssl(self, vector):

        self._verify_negative_cases()
        # TODO: This is really two different tests, but the custom cluster takes too long to
        # start. Make it so that custom clusters can be specified across test suites.
        self._validate_positive_cases("%s/server-cert.pem" % self.CERT_DIR)

        # No certificate checking: will accept any cert.
        self._validate_positive_cases()

        # Test cancelling a query
        impalad = ImpaladService(socket.getfqdn())
        impalad.wait_for_num_in_flight_queries(0)
        p = ImpalaShell(args="--ssl")
        p.send_cmd("SET DEBUG_ACTION=0:OPEN:WAIT")
        p.send_cmd("select count(*) from functional.alltypes")
        impalad.wait_for_num_in_flight_queries(1)

        LOG = logging.getLogger('test_client_ssl')
        LOG.info("Cancelling query")
        num_tries = 0
        # In practice, sending SIGINT to the shell process doesn't always seem to get caught
        # (and a search shows up some bugs in Python where SIGINT might be ignored). So retry
        # for 30s until one signal takes.
        while impalad.get_num_in_flight_queries() == 1:
            time.sleep(1)
            LOG.info("Sending signal...")
            os.kill(p.pid(), signal.SIGINT)
            num_tries += 1
            assert num_tries < 30, "SIGINT was not caught by shell within 30s"

        p.send_cmd("profile")
        result = p.get_result()

        print result.stderr
        assert result.rc == 0
        assert "Query Status: Cancelled" in result.stdout
        assert impalad.wait_for_num_in_flight_queries(0)