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)