@@ -73,7 +73,9 @@ class VolatileLayerClientTest : public ::testing::Test {
7373 void TearDown () override {
7474 auto network = std::move (settings_.network_request_handler );
7575 // when test ends we must be sure that network pointer is not captured
76- // anywhere
76+ // anywhere. Also network is still used in authentication settings and in
77+ // TokenProvider internally so it needs to be cleared.
78+ settings_ = olp::client::OlpClientSettings ();
7779 EXPECT_EQ (network.use_count (), 1 );
7880 }
7981
@@ -97,17 +99,13 @@ TEST_F(VolatileLayerClientTest, GetPartitions) {
9799 VolatileLayerClient client (hrn, GetTestLayer (), settings_);
98100
99101 olp::client::Condition condition;
100- VolatileLayerClient::PartitionsResponse
101- partitions_response;
102-
103- auto callback =
104- [&](VolatileLayerClient::PartitionsResponse
105- response) {
106- partitions_response = std::move (response);
107- condition.Notify ();
108- };
109- client.GetPartitions (PartitionsRequest (),
110- std::move (callback));
102+ VolatileLayerClient::PartitionsResponse partitions_response;
103+
104+ auto callback = [&](VolatileLayerClient::PartitionsResponse response) {
105+ partitions_response = std::move (response);
106+ condition.Notify ();
107+ };
108+ client.GetPartitions (PartitionsRequest (), std::move (callback));
111109 ASSERT_TRUE (condition.Wait (kTimeout ));
112110 EXPECT_TRUE (partitions_response.IsSuccessful ());
113111 }
@@ -118,18 +116,14 @@ TEST_F(VolatileLayerClientTest, GetPartitions) {
118116 VolatileLayerClient client (hrn, GetTestLayer (), settings_);
119117
120118 olp::client::Condition condition;
121- VolatileLayerClient::PartitionsResponse
122- partitions_response;
123-
124- auto callback =
125- [&](VolatileLayerClient::PartitionsResponse
126- response) {
127- partitions_response = std::move (response);
128- condition.Notify ();
129- };
119+ VolatileLayerClient::PartitionsResponse partitions_response;
120+
121+ auto callback = [&](VolatileLayerClient::PartitionsResponse response) {
122+ partitions_response = std::move (response);
123+ condition.Notify ();
124+ };
130125 client.GetPartitions (
131- PartitionsRequest ().WithFetchOption (
132- FetchOptions::CacheWithUpdate),
126+ PartitionsRequest ().WithFetchOption (FetchOptions::CacheWithUpdate),
133127 std::move (callback));
134128 ASSERT_TRUE (condition.Wait (kTimeout ));
135129 EXPECT_TRUE (partitions_response.IsSuccessful ());
@@ -141,17 +135,13 @@ TEST_F(VolatileLayerClientTest, GetPartitions) {
141135 VolatileLayerClient client (hrn, " InvalidLayer" , settings_);
142136
143137 olp::client::Condition condition;
144- VolatileLayerClient::PartitionsResponse
145- partitions_response;
146-
147- auto callback =
148- [&](VolatileLayerClient::PartitionsResponse
149- response) {
150- partitions_response = std::move (response);
151- condition.Notify ();
152- };
153- client.GetPartitions (PartitionsRequest (),
154- std::move (callback));
138+ VolatileLayerClient::PartitionsResponse partitions_response;
139+
140+ auto callback = [&](VolatileLayerClient::PartitionsResponse response) {
141+ partitions_response = std::move (response);
142+ condition.Notify ();
143+ };
144+ client.GetPartitions (PartitionsRequest (), std::move (callback));
155145 ASSERT_TRUE (condition.Wait (kTimeout ));
156146 EXPECT_FALSE (partitions_response.IsSuccessful ());
157147 }
@@ -163,39 +153,32 @@ TEST_F(VolatileLayerClientTest, GetPartitions) {
163153 settings_);
164154
165155 olp::client::Condition condition;
166- VolatileLayerClient::PartitionsResponse
167- partitions_response;
168-
169- auto callback =
170- [&](VolatileLayerClient::PartitionsResponse
171- response) {
172- partitions_response = std::move (response);
173- condition.Notify ();
174- };
175- client.GetPartitions (PartitionsRequest (),
176- std::move (callback));
156+ VolatileLayerClient::PartitionsResponse partitions_response;
157+
158+ auto callback = [&](VolatileLayerClient::PartitionsResponse response) {
159+ partitions_response = std::move (response);
160+ condition.Notify ();
161+ };
162+ client.GetPartitions (PartitionsRequest (), std::move (callback));
177163 ASSERT_TRUE (condition.Wait (kTimeout ));
178164 EXPECT_FALSE (partitions_response.IsSuccessful ());
179165 }
180166}
181167
182- TEST_F (VolatileLayerClientTest, GetPartitionsDifferentFethOptions ) {
168+ TEST_F (VolatileLayerClientTest, GetPartitionsDifferentFetchOptions ) {
183169 olp::client::HRN hrn (GetTestCatalog ());
184170 {
185171 SCOPED_TRACE (" Get Partitions Online Only" );
186172
187173 VolatileLayerClient client (hrn, GetTestLayer (), settings_);
188174
189175 olp::client::Condition condition;
190- VolatileLayerClient::PartitionsResponse
191- partitions_response;
192-
193- auto callback =
194- [&](VolatileLayerClient::PartitionsResponse
195- response) {
196- partitions_response = std::move (response);
197- condition.Notify ();
198- };
176+ VolatileLayerClient::PartitionsResponse partitions_response;
177+
178+ auto callback = [&](VolatileLayerClient::PartitionsResponse response) {
179+ partitions_response = std::move (response);
180+ condition.Notify ();
181+ };
199182 client.GetPartitions (
200183 PartitionsRequest ().WithFetchOption (FetchOptions::OnlineOnly),
201184 std::move (callback));
@@ -208,15 +191,12 @@ TEST_F(VolatileLayerClientTest, GetPartitionsDifferentFethOptions) {
208191 VolatileLayerClient client (hrn, GetTestLayer (), settings_);
209192
210193 olp::client::Condition condition;
211- VolatileLayerClient::PartitionsResponse
212- partitions_response;
213-
214- auto callback =
215- [&](VolatileLayerClient::PartitionsResponse
216- response) {
217- partitions_response = std::move (response);
218- condition.Notify ();
219- };
194+ VolatileLayerClient::PartitionsResponse partitions_response;
195+
196+ auto callback = [&](VolatileLayerClient::PartitionsResponse response) {
197+ partitions_response = std::move (response);
198+ condition.Notify ();
199+ };
220200 client.GetPartitions (
221201 PartitionsRequest ().WithFetchOption (FetchOptions::CacheOnly),
222202 std::move (callback));
0 commit comments