|
1 | 1 | #include "ut_utils/topic_sdk_test_setup.h" |
2 | 2 |
|
3 | | -#include <format> |
4 | | -#include <src/library/persqueue/topic_parser_public/topic_parser.h> |
5 | | -#include <src/api/protos/persqueue_error_codes_v1.pb.h> |
6 | 3 | #include <ydb-cpp-sdk/client/topic/client.h> |
7 | | -#include <src/client/persqueue_public/persqueue.h> |
8 | | -#include <src/client/topic/common/log_lazy.h> |
9 | | -#include <src/client/topic/impl/common.h> |
10 | 4 |
|
11 | 5 | #include <library/cpp/testing/unittest/registar.h> |
12 | | -#include <library/cpp/testing/unittest/tests_data.h> |
13 | | -#include <library/cpp/threading/future/future.h> |
14 | | -#include <library/cpp/threading/future/async.h> |
15 | 6 |
|
16 | 7 | namespace NYdb::NTopic::NTests { |
17 | 8 |
|
@@ -258,106 +249,10 @@ namespace NYdb::NTopic::NTests { |
258 | 249 | } |
259 | 250 | } |
260 | 251 |
|
261 | | - Y_UNIT_TEST(Basic) { |
262 | | - TTopicSdkTestSetup setup(TEST_CASE_NAME); |
263 | | - TTopicClient client = setup.MakeClient(); |
264 | | - |
265 | | - DescribeTopic(setup, client, false, false, false, false); |
266 | | - DescribeConsumer(setup, client, false, false, false, false); |
267 | | - DescribePartition(setup, client, false, false, false, false); |
268 | | - } |
269 | | - |
270 | | - Y_UNIT_TEST(Statistics) { |
271 | | - // TODO(abcdef): temporarily deleted |
272 | | - return; |
273 | | - |
274 | | - TTopicSdkTestSetup setup(TEST_CASE_NAME); |
275 | | - TTopicClient client = setup.MakeClient(); |
276 | | - |
277 | | - // Get empty description |
278 | | - DescribeTopic(setup, client, true, false, false, false); |
279 | | - DescribeConsumer(setup, client, true, false, false, false); |
280 | | - DescribePartition(setup, client, true, false, false, false); |
281 | | - |
282 | | - const size_t messagesCount = 1; |
283 | | - |
284 | | - // Write a message |
285 | | - { |
286 | | - auto writeSettings = TWriteSessionSettings().Path(TEST_TOPIC).MessageGroupId(TEST_MESSAGE_GROUP_ID).Codec(ECodec::RAW); |
287 | | - auto writeSession = client.CreateSimpleBlockingWriteSession(writeSettings); |
288 | | - std::string message(32_MB, 'x'); |
289 | | - |
290 | | - for(size_t i = 0; i < messagesCount; ++i) { |
291 | | - UNIT_ASSERT(writeSession->Write(message, {}, TInstant::Now() - TDuration::Seconds(100))); |
292 | | - } |
293 | | - writeSession->Close(); |
294 | | - } |
295 | | - |
296 | | - // Read a message |
297 | | - { |
298 | | - auto readSettings = TReadSessionSettings().ConsumerName(TEST_CONSUMER).AppendTopics(TEST_TOPIC); |
299 | | - auto readSession = client.CreateReadSession(readSettings); |
300 | | - |
301 | | - // Event 1: start partition session |
302 | | - { |
303 | | - std::optional<TReadSessionEvent::TEvent> event = readSession->GetEvent(true); |
304 | | - UNIT_ASSERT(event); |
305 | | - auto startPartitionSession = std::get_if<TReadSessionEvent::TStartPartitionSessionEvent>(&event.value()); |
306 | | - UNIT_ASSERT_C(startPartitionSession, DebugString(*event)); |
307 | | - |
308 | | - startPartitionSession->Confirm(); |
309 | | - } |
310 | | - |
311 | | - // Event 2: data received |
312 | | - { |
313 | | - std::optional<TReadSessionEvent::TEvent> event = readSession->GetEvent(true); |
314 | | - UNIT_ASSERT(event); |
315 | | - auto dataReceived = std::get_if<TReadSessionEvent::TDataReceivedEvent>(&event.value()); |
316 | | - UNIT_ASSERT_C(dataReceived, DebugString(*event)); |
317 | | - |
318 | | - dataReceived->Commit(); |
319 | | - } |
320 | | - |
321 | | - // Event 3: commit acknowledgement |
322 | | - { |
323 | | - std::optional<TReadSessionEvent::TEvent> event = readSession->GetEvent(true); |
324 | | - UNIT_ASSERT(event); |
325 | | - auto commitOffsetAck = std::get_if<TReadSessionEvent::TCommitOffsetAcknowledgementEvent>(&event.value()); |
326 | | - |
327 | | - UNIT_ASSERT_C(commitOffsetAck, DebugString(*event)); |
328 | | - |
329 | | - UNIT_ASSERT_VALUES_EQUAL(commitOffsetAck->GetCommittedOffset(), messagesCount); |
330 | | - } |
331 | | - } |
332 | | - |
333 | | - // Additional write |
334 | | - { |
335 | | - auto writeSettings = TWriteSessionSettings().Path(TEST_TOPIC).MessageGroupId(TEST_MESSAGE_GROUP_ID).Codec(ECodec::RAW); |
336 | | - auto writeSession = client.CreateSimpleBlockingWriteSession(writeSettings); |
337 | | - std::string message(32, 'x'); |
338 | | - |
339 | | - for(size_t i = 0; i < messagesCount; ++i) { |
340 | | - UNIT_ASSERT(writeSession->Write(message)); |
341 | | - } |
342 | | - writeSession->Close(); |
343 | | - } |
344 | | - Sleep(TDuration::Seconds(3)); |
345 | | - |
346 | | - // Get non-empty description |
347 | | - |
348 | | - DescribeTopic(setup, client, true, true, false, false); |
349 | | - DescribeConsumer(setup, client, true, true, false, false); |
350 | | - DescribePartition(setup, client, true, true, false, false); |
351 | | - } |
352 | | - |
353 | 252 | Y_UNIT_TEST(Location) { |
354 | 253 | TTopicSdkTestSetup setup(TEST_CASE_NAME); |
355 | 254 | TTopicClient client = setup.MakeClient(); |
356 | 255 |
|
357 | | - DescribeTopic(setup, client, false, false, true, false); |
358 | | - DescribeConsumer(setup, client, false, false, true, false); |
359 | | - DescribePartition(setup, client, false, false, true, false); |
360 | | - |
361 | 256 | // Describe with KillTablets |
362 | 257 | DescribeTopic(setup, client, false, false, true, true); |
363 | 258 | DescribeConsumer(setup, client, false, false, true, true); |
|
0 commit comments