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

Function TEST

be/src/statestore/statestore-test.cc:43–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41static ObjectPool* perm_objects;
42
43TEST(StatestoreTest, SmokeTest) {
44 // All allocations done by 'new' to avoid problems shutting down Thrift servers
45 // gracefully.
46 MetricGroup* metrics = perm_objects->Add(new MetricGroup("statestore"));
47 Statestore* statestore = perm_objects->Add(new Statestore(metrics));
48 // Thrift will internally pick an ephemeral port if we pass in 0 as the port.
49 int statestore_port = 0;
50 ASSERT_OK(statestore->Init(statestore_port));
51
52 MetricGroup* metrics_2 = perm_objects->Add(new MetricGroup("statestore_2"));
53 // Port already in use
54 Statestore* statestore_wont_start = perm_objects->Add(new Statestore(metrics_2));
55 ASSERT_FALSE(statestore_wont_start->Init(statestore->port()).ok());
56 statestore_wont_start->ShutdownForTesting();
57
58 StatestoreSubscriber* sub_will_start = perm_objects->Add(
59 new StatestoreSubscriber("sub1", MakeNetworkAddress("localhost", 0),
60 MakeNetworkAddress("localhost", statestore->port()), MakeNetworkAddress("", 0),
61 new MetricGroup(""), TStatestoreSubscriberType::COORDINATOR_EXECUTOR));
62 ASSERT_OK(sub_will_start->Start());
63
64 // Confirm that a subscriber trying to use an in-use port will fail to start.
65 StatestoreSubscriber* sub_will_not_start = perm_objects->Add(new StatestoreSubscriber(
66 "sub3", MakeNetworkAddress("localhost", sub_will_start->heartbeat_port()),
67 MakeNetworkAddress("localhost", statestore->port()), MakeNetworkAddress("", 0),
68 new MetricGroup(""), TStatestoreSubscriberType::COORDINATOR_EXECUTOR));
69 ASSERT_FALSE(sub_will_not_start->Start().ok());
70
71 statestore->ShutdownForTesting();
72}
73
74// Runs an SSL smoke test with provided parameters.
75void SslSmokeTestHelper(const string& server_ca_certificate,

Callers

nothing calls this directly

Calls 11

MakeNetworkAddressFunction · 0.85
GetValidServerCertFunction · 0.85
SslSmokeTestHelperFunction · 0.85
ShutdownForTestingMethod · 0.80
heartbeat_portMethod · 0.80
AddMethod · 0.45
InitMethod · 0.45
okMethod · 0.45
portMethod · 0.45
StartMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected