Runs an SSL smoke test with provided parameters.
| 73 | |
| 74 | // Runs an SSL smoke test with provided parameters. |
| 75 | void SslSmokeTestHelper(const string& server_ca_certificate, |
| 76 | const string& client_ca_certificate, bool sub_should_start) { |
| 77 | string impala_home(getenv("IMPALA_HOME")); |
| 78 | stringstream server_cert; |
| 79 | server_cert << impala_home << "/be/src/testutil/server-cert.pem"; |
| 80 | // Override flags for the duration of this test. Modifying them while the statestore |
| 81 | // is running is unsafe. |
| 82 | FLAGS_ssl_server_certificate = server_ca_certificate; |
| 83 | FLAGS_ssl_client_ca_certificate = client_ca_certificate; |
| 84 | stringstream server_key; |
| 85 | server_key << impala_home << "/be/src/testutil/server-key.pem"; |
| 86 | FLAGS_ssl_private_key = server_key.str(); |
| 87 | |
| 88 | // Thrift will internally pick an ephemeral port if we pass in 0 as the port. |
| 89 | int statestore_port = 0; |
| 90 | MetricGroup* metrics = perm_objects->Add(new MetricGroup("statestore")); |
| 91 | Statestore* statestore = perm_objects->Add(new Statestore(metrics)); |
| 92 | ASSERT_OK(statestore->Init(statestore_port)); |
| 93 | |
| 94 | StatestoreSubscriber* sub = perm_objects->Add( |
| 95 | new StatestoreSubscriber("smoke_sub", MakeNetworkAddress("localhost", 0), |
| 96 | MakeNetworkAddress("localhost", statestore->port()), MakeNetworkAddress("", 0), |
| 97 | new MetricGroup(""), TStatestoreSubscriberType::COORDINATOR_EXECUTOR)); |
| 98 | Status sub_status = sub->Start(); |
| 99 | ASSERT_EQ(sub_should_start, sub_status.ok()); |
| 100 | |
| 101 | statestore->ShutdownForTesting(); |
| 102 | } |
| 103 | |
| 104 | string GetValidServerCert() { |
| 105 | string impala_home(getenv("IMPALA_HOME")); |
no test coverage detected