MCPcopy Create free account
hub / github.com/apache/impala / test_ssl

Method test_ssl

tests/custom_cluster/test_client_ssl.py:82–123  ·  view source on GitHub ↗
(self, vector)

Source from the content-addressed store, hash-verified

80 @CustomClusterTestSuite.with_args(impalad_args=SSL_ARGS, statestored_args=SSL_ARGS,
81 catalogd_args=SSL_ARGS)
82 def test_ssl(self, vector):
83 self._verify_negative_cases(vector, "%s/server-cert.pem" % CERT_DIR)
84 # TODO: This is really two different tests, but the custom cluster takes too long to
85 # start. Make it so that custom clusters can be specified across test suites.
86 self._validate_positive_cases(vector, "%s/server-cert.pem" % CERT_DIR)
87
88 # No certificate checking: will accept any cert.
89 self._validate_positive_cases(vector, )
90
91 # Test cancelling a query
92 impalad = ImpaladService(socket.getfqdn())
93 assert impalad.wait_for_num_in_flight_queries(0)
94 impalad.wait_for_metric_value('impala-server.backend-num-queries-executing', 0)
95 p = ImpalaShell(vector, args=["--ssl"])
96 p.send_cmd("SET DEBUG_ACTION=0:OPEN:WAIT")
97 p.send_cmd("select count(*) from functional.alltypes")
98 # Wait until the query has been planned and started executing, at which point it
99 # should be cancellable.
100 impalad.wait_for_metric_value('impala-server.backend-num-queries-executing', 1,
101 timeout=60)
102
103 LOG = logging.getLogger('test_client_ssl')
104 LOG.info("Cancelling query")
105 num_tries = 0
106 # In practice, sending SIGINT to the shell process doesn't always seem to get caught
107 # (and a search shows up some bugs in Python where SIGINT might be ignored). So retry
108 # for 30s until one signal takes.
109 while impalad.get_num_in_flight_queries() == 1:
110 time.sleep(1)
111 LOG.info("Sending signal...")
112 os.kill(p.pid(), signal.SIGINT)
113 num_tries += 1
114 assert num_tries < 30, ("SIGINT was not caught by shell within 30s. Queries: " +
115 json.dumps(impalad.get_queries_json(), indent=2))
116
117 p.send_cmd("profile")
118 result = p.get_result()
119
120 print(result.stderr)
121 assert "Query Status: Cancelled" in result.stdout
122 assert impalad.wait_for_num_in_flight_queries(0)
123 self.check_connections()
124
125 WEBSERVER_SSL_ARGS = ("--webserver_certificate_file=%(cert_dir)s/server-cert.pem "
126 "--webserver_private_key_file=%(cert_dir)s/server-key.pem "

Callers

nothing calls this directly

Calls 13

send_cmdMethod · 0.95
pidMethod · 0.95
get_queries_jsonMethod · 0.95
get_resultMethod · 0.95
ImpaladServiceClass · 0.90
ImpalaShellClass · 0.90
wait_for_metric_valueMethod · 0.80
check_connectionsMethod · 0.80

Tested by

no test coverage detected