@@ -285,6 +285,8 @@ TEST_F(ClientStatisticsTest, testClientStatisticsDisabledByDefault)
285
285
ASSERT_TRUE (statsFromServer.success );
286
286
ASSERT_TRUE (statsFromServer.message .empty ())
287
287
<< " Statistics should be disabled by default." ;
288
+
289
+ client.shutdown ().get ();
288
290
}
289
291
290
292
TEST_F (ClientStatisticsTest, testNoUpdateWhenDisabled)
@@ -296,6 +298,8 @@ TEST_F(ClientStatisticsTest, testNoUpdateWhenDisabled)
296
298
auto client = hazelcast::new_client (std::move (clientConfig)).get ();
297
299
298
300
ASSERT_TRUE_ALL_THE_TIME (get_stats ().empty (), 2 );
301
+
302
+ client.shutdown ().get ();
299
303
}
300
304
301
305
TEST_F (ClientStatisticsTest, testClientStatisticsDisabledWithWrongValue)
@@ -314,6 +318,8 @@ TEST_F(ClientStatisticsTest, testClientStatisticsDisabledWithWrongValue)
314
318
ASSERT_TRUE (statsFromServer.success );
315
319
ASSERT_TRUE (statsFromServer.message .empty ())
316
320
<< " Statistics should not be enabled with wrong value." ;
321
+
322
+ client.shutdown ().get ();
317
323
}
318
324
319
325
TEST_F (ClientStatisticsTest, testClientStatisticsContent)
@@ -405,6 +411,8 @@ TEST_F(ClientStatisticsTest, testClientStatisticsContent)
405
411
ASSERT_NE (std::string::npos,
406
412
statsFromServer.result .find (std::string (" nc." ) + test_name + " ." +
407
413
" creationTime" ));
414
+
415
+ client.shutdown ().get ();
408
416
}
409
417
410
418
TEST_F (ClientStatisticsTest, testStatisticsCollectionNonDefaultPeriod)
@@ -500,6 +508,8 @@ TEST_F(ClientStatisticsTest, testStatisticsCollectionNonDefaultPeriod)
500
508
<< mapHitsKey << " stat should exist (" << to_string (statsMap) << " )" ;
501
509
ASSERT_EQ (" 1" , statsMap[mapHitsKey])
502
510
<< " Expected 1 map hits (" << to_string (statsMap) << " )" ;
511
+
512
+ client->shutdown ().get ();
503
513
}
504
514
505
515
TEST_F (ClientStatisticsTest, testStatisticsPeriod)
@@ -520,6 +530,8 @@ TEST_F(ClientStatisticsTest, testStatisticsPeriod)
520
530
521
531
ASSERT_NE (initialStats, get_stats ())
522
532
<< " initial statistics should not be the same as current stats" ;
533
+
534
+ client->shutdown ().get ();
523
535
}
524
536
} // namespace test
525
537
} // namespace client
@@ -607,8 +619,16 @@ class RingbufferTest : public ClientTest
607
619
608
620
static void TearDownTestCase ()
609
621
{
610
- delete client;
611
- delete client2;
622
+ if (client) {
623
+ client->shutdown ().get ();
624
+ delete client;
625
+ }
626
+
627
+ if (client2) {
628
+ client2->shutdown ().get ();
629
+ delete client2;
630
+ }
631
+
612
632
delete instance;
613
633
614
634
client = nullptr ;
@@ -887,6 +907,7 @@ class ssl_test_base : public ClientTest
887
907
auto client = new_client (std::move (config)).get ();
888
908
auto map = client.get_map (" test" ).get ();
889
909
ASSERT_NO_THROW (map->put (5 , std::vector<byte>(1024 )).get ());
910
+ client.shutdown ().get ();
890
911
}
891
912
892
913
void test_ssl_disabled ()
@@ -1429,6 +1450,8 @@ TEST_P(ClusterTest, testAllClientStates)
1429
1450
ASSERT_OPEN_EVENTUALLY (disconnectedLatch);
1430
1451
ASSERT_OPEN_EVENTUALLY (shuttingDownLatch);
1431
1452
ASSERT_OPEN_EVENTUALLY (shutdownLatch);
1453
+
1454
+ client.shutdown ().get ();
1432
1455
}
1433
1456
1434
1457
TEST_P (ClusterTest, testConnectionAttemptPeriod)
@@ -1519,6 +1542,8 @@ TEST_F(HeartbeatTest, testPing)
1519
1542
1520
1543
// perform a map put
1521
1544
ASSERT_NO_THROW (hz.get_map (" short-heartbeat-map" ).get ()->put (1 , 1 ));
1545
+
1546
+ hz.shutdown ().get ();
1522
1547
}
1523
1548
} // namespace test
1524
1549
} // namespace client
@@ -1552,6 +1577,7 @@ TEST_F(SocketInterceptorTest, interceptSSLBasic)
1552
1577
config.set_socket_interceptor (std::move (interceptor));
1553
1578
hazelcast_client hz{ hazelcast::new_client (std::move (config)).get () };
1554
1579
interceptorLatch.wait_for (boost::chrono::seconds (2 ));
1580
+ hz.shutdown ().get ();
1555
1581
}
1556
1582
1557
1583
#endif
@@ -1565,6 +1591,7 @@ TEST_F(SocketInterceptorTest, interceptBasic)
1565
1591
config.set_socket_interceptor (std::move (interceptor));
1566
1592
hazelcast_client hz{ hazelcast::new_client (std::move (config)).get () };
1567
1593
interceptorLatch.wait_for (boost::chrono::seconds (2 ));
1594
+ hz.shutdown ().get ();
1568
1595
}
1569
1596
} // namespace test
1570
1597
} // namespace client
@@ -1598,6 +1625,8 @@ TEST_F(SocketOptionsTest, testConfiguration)
1598
1625
ASSERT_FALSE (socketOptions.is_tcp_no_delay ());
1599
1626
ASSERT_EQ (5 , socketOptions.get_linger_seconds ());
1600
1627
ASSERT_EQ (bufferSize, socketOptions.get_buffer_size_in_bytes ());
1628
+
1629
+ client.shutdown ().get ();
1601
1630
}
1602
1631
} // namespace test
1603
1632
} // namespace client
@@ -1620,6 +1649,8 @@ TEST_F(ClientAuthenticationTest, testUserPasswordCredentials)
1620
1649
std::make_shared<security::username_password_credentials>(" test-user" ,
1621
1650
" test-pass" ));
1622
1651
hazelcast_client hz{ hazelcast::new_client (std::move (config)).get () };
1652
+
1653
+ hz.shutdown ().get ();
1623
1654
}
1624
1655
1625
1656
TEST_F (ClientAuthenticationTest, testTokenCredentials)
@@ -1632,6 +1663,8 @@ TEST_F(ClientAuthenticationTest, testTokenCredentials)
1632
1663
config.set_cluster_name (" token-credentials-dev" )
1633
1664
.set_credentials (std::make_shared<security::token_credentials>(my_token));
1634
1665
hazelcast_client hz{ hazelcast::new_client (std::move (config)).get () };
1666
+
1667
+ hz.shutdown ().get ();
1635
1668
}
1636
1669
1637
1670
TEST_F (ClientAuthenticationTest, testIncorrectGroupName)
@@ -1677,6 +1710,8 @@ TEST_F(ClientEnpointTest, testConnectedClientEnpoint)
1677
1710
ASSERT_TRUE (localAddress);
1678
1711
ASSERT_EQ (*localAddress, *endpointAddress);
1679
1712
ASSERT_EQ (connectionManager.get_client_uuid (), endpoint.get_uuid ());
1713
+
1714
+ client.shutdown ().get ();
1680
1715
}
1681
1716
} // namespace test
1682
1717
} // namespace client
@@ -1700,6 +1735,8 @@ TEST_F(MemberAttributeTest, testInitialValues)
1700
1735
ASSERT_TRUE (member.lookup_attribute (attribute_name));
1701
1736
ASSERT_EQ (" test-member-attribute-value" ,
1702
1737
*member.get_attribute (attribute_name));
1738
+
1739
+ hazelcastClient.shutdown ().get ();
1703
1740
}
1704
1741
1705
1742
} // namespace test
@@ -1722,7 +1759,11 @@ class BasicPnCounterAPITest : public ClientTest
1722
1759
1723
1760
static void TearDownTestCase ()
1724
1761
{
1725
- delete client;
1762
+ if (client) {
1763
+ client->shutdown ().get ();
1764
+ delete client;
1765
+ }
1766
+
1726
1767
delete instance;
1727
1768
1728
1769
client = nullptr ;
@@ -1880,7 +1921,10 @@ class PnCounterFunctionalityTest : public ClientTest
1880
1921
1881
1922
static void TearDownTestCase ()
1882
1923
{
1883
- delete client;
1924
+ if (client) {
1925
+ client->shutdown ().get ();
1926
+ delete client;
1927
+ }
1884
1928
delete instance;
1885
1929
1886
1930
client = nullptr ;
@@ -1958,6 +2002,8 @@ TEST_F(ClientPNCounterNoDataMemberTest, noDataMemberExceptionIsThrown)
1958
2002
1959
2003
ASSERT_THROW (pnCounter->add_and_get (5 ).get (),
1960
2004
exception::no_data_member_in_cluster);
2005
+
2006
+ hz.shutdown ().get ();
1961
2007
}
1962
2008
1963
2009
/* *
@@ -2012,6 +2058,8 @@ TEST_F(ClientPNCounterConsistencyLostTest,
2012
2058
terminate_member (*currentTarget, instance, instance2);
2013
2059
2014
2060
ASSERT_THROW (pnCounter->add_and_get (5 ).get (), exception::consistency_lost);
2061
+
2062
+ hz.shutdown ().get ();
2015
2063
}
2016
2064
2017
2065
TEST_F (ClientPNCounterConsistencyLostTest,
@@ -2042,6 +2090,8 @@ TEST_F(ClientPNCounterConsistencyLostTest,
2042
2090
pnCounter->reset ().get ();
2043
2091
2044
2092
pnCounter->add_and_get (5 ).get ();
2093
+
2094
+ hz.shutdown ().get ();
2045
2095
}
2046
2096
} // namespace pncounter
2047
2097
} // namespace crdt
@@ -2121,6 +2171,8 @@ TEST_P(SimpleListenerTest, testSharedClusterListeners)
2121
2171
cluster.remove_membership_listener (initialListenerRegistrationId));
2122
2172
ASSERT_TRUE (
2123
2173
cluster.remove_membership_listener (sampleListenerRegistrationId));
2174
+
2175
+ hazelcastClient.shutdown ().get ();
2124
2176
}
2125
2177
2126
2178
TEST_P (SimpleListenerTest, testClusterListeners)
@@ -2154,6 +2206,8 @@ TEST_P(SimpleListenerTest, testClusterListeners)
2154
2206
2155
2207
ASSERT_TRUE (cluster.remove_membership_listener (init_id));
2156
2208
ASSERT_TRUE (cluster.remove_membership_listener (id));
2209
+
2210
+ hazelcastClient.shutdown ().get ();
2157
2211
}
2158
2212
2159
2213
TEST_P (SimpleListenerTest, testClusterListenersFromConfig)
@@ -2184,6 +2238,8 @@ TEST_P(SimpleListenerTest, testClusterListenersFromConfig)
2184
2238
ASSERT_OPEN_EVENTUALLY (memberRemovedInit);
2185
2239
2186
2240
instance.shutdown ();
2241
+
2242
+ hazelcastClient.shutdown ().get ();
2187
2243
}
2188
2244
2189
2245
TEST_P (SimpleListenerTest, testDeregisterListener)
@@ -2221,6 +2277,8 @@ TEST_P(SimpleListenerTest, testDeregisterListener)
2221
2277
map->clear ().get ();
2222
2278
ASSERT_OPEN_EVENTUALLY (map_clearedLatch);
2223
2279
ASSERT_TRUE (map->remove_entry_listener (listenerRegistrationId).get ());
2280
+
2281
+ hazelcastClient.shutdown ().get ();
2224
2282
}
2225
2283
2226
2284
TEST_P (SimpleListenerTest, testEmptyListener)
@@ -2249,6 +2307,8 @@ TEST_P(SimpleListenerTest, testEmptyListener)
2249
2307
std::this_thread::sleep_for (std::chrono::milliseconds (500 ));
2250
2308
2251
2309
ASSERT_TRUE (map->remove_entry_listener (listenerRegistrationId).get ());
2310
+
2311
+ hazelcastClient.shutdown ().get ();
2252
2312
}
2253
2313
2254
2314
INSTANTIATE_TEST_SUITE_P (
@@ -2290,7 +2350,10 @@ class FlakeIdGeneratorApiTest : public ClientTest
2290
2350
2291
2351
static void TearDownTestCase ()
2292
2352
{
2293
- delete client;
2353
+ if (client) {
2354
+ client->shutdown ().get ();
2355
+ delete client;
2356
+ }
2294
2357
delete instance;
2295
2358
2296
2359
client = nullptr ;
@@ -2400,7 +2463,10 @@ ClientTxnMapTest::ClientTxnMapTest()
2400
2463
, client_(get_new_client())
2401
2464
{}
2402
2465
2403
- ClientTxnMapTest::~ClientTxnMapTest () = default ;
2466
+ ClientTxnMapTest::~ClientTxnMapTest ()
2467
+ {
2468
+ client_.shutdown ().get ();
2469
+ }
2404
2470
2405
2471
TEST_F (ClientTxnMapTest, testPutGet)
2406
2472
{
@@ -2823,7 +2889,10 @@ ClientTxnSetTest::ClientTxnSetTest()
2823
2889
, client_(get_new_client())
2824
2890
{}
2825
2891
2826
- ClientTxnSetTest::~ClientTxnSetTest () = default ;
2892
+ ClientTxnSetTest::~ClientTxnSetTest ()
2893
+ {
2894
+ client_.shutdown ().get ();
2895
+ }
2827
2896
2828
2897
TEST_F (ClientTxnSetTest, testAddRemove)
2829
2898
{
@@ -2972,6 +3041,8 @@ TEST_F(ClientTxnTest, testTxnCommitUniSocket)
2972
3041
auto retrievedElement = q->poll <std::string>().get ();
2973
3042
ASSERT_TRUE (retrievedElement.has_value ());
2974
3043
ASSERT_EQ (value, retrievedElement.value ());
3044
+
3045
+ uniSocketClient.shutdown ().get ();
2975
3046
}
2976
3047
2977
3048
TEST_F (ClientTxnTest, testTxnCommitWithOptions)
@@ -3100,6 +3171,7 @@ TEST_F(ClientTxnTest, testTxnInitAndNextMethod)
3100
3171
});
3101
3172
3102
3173
clientConfig.set_load_balancer (std::move (tmp_load_balancer));
3174
+ client_->shutdown ().get ();
3103
3175
client_.reset (
3104
3176
new hazelcast_client{ new_client (std::move (clientConfig)).get () });
3105
3177
@@ -3127,6 +3199,8 @@ TEST_F(ClientTxnTest, testTxnInitAndNextMethodRValue)
3127
3199
}
3128
3200
return boost::make_optional<member>(std::move (members[0 ]));
3129
3201
}));
3202
+
3203
+ client_->shutdown ().get ();
3130
3204
client_.reset (
3131
3205
new hazelcast_client{ new_client (std::move (clientConfig)).get () });
3132
3206
@@ -3159,7 +3233,10 @@ ClientTxnListTest::ClientTxnListTest()
3159
3233
, client_(get_new_client())
3160
3234
{}
3161
3235
3162
- ClientTxnListTest::~ClientTxnListTest () = default ;
3236
+ ClientTxnListTest::~ClientTxnListTest ()
3237
+ {
3238
+ client_.shutdown ().get ();
3239
+ }
3163
3240
3164
3241
TEST_F (ClientTxnListTest, testAddRemove)
3165
3242
{
@@ -3215,7 +3292,10 @@ ClientTxnMultiMapTest::ClientTxnMultiMapTest()
3215
3292
, client_(get_new_client())
3216
3293
{}
3217
3294
3218
- ClientTxnMultiMapTest::~ClientTxnMultiMapTest () = default ;
3295
+ ClientTxnMultiMapTest::~ClientTxnMultiMapTest ()
3296
+ {
3297
+ client_.shutdown ().get ();
3298
+ };
3219
3299
3220
3300
TEST_F (ClientTxnMultiMapTest, testRemoveIfExists)
3221
3301
{
@@ -3319,7 +3399,10 @@ ClientTxnQueueTest::ClientTxnQueueTest()
3319
3399
, client_(get_new_client())
3320
3400
{}
3321
3401
3322
- ClientTxnQueueTest::~ClientTxnQueueTest () = default ;
3402
+ ClientTxnQueueTest::~ClientTxnQueueTest ()
3403
+ {
3404
+ client_.shutdown ().get ();
3405
+ };
3323
3406
3324
3407
TEST_F (ClientTxnQueueTest, testTransactionalOfferPoll1)
3325
3408
{
0 commit comments