11using Grpc . Core ;
22using Moq ;
33using Xunit ;
4- using Xunit . Abstractions ;
54using Ydb . Issue ;
65using Ydb . Sdk . Services . Topic ;
76using Ydb . Sdk . Services . Topic . Writer ;
@@ -15,13 +14,11 @@ namespace Ydb.Sdk.Tests.Topic;
1514
1615public class WriterUnitTests
1716{
18- private readonly ITestOutputHelper _testOutputHelper ;
1917 private readonly Mock < IDriver > _mockIDriver = new ( ) ;
2018 private readonly Mock < WriterStream > _mockStream = new ( ) ;
2119
22- public WriterUnitTests ( ITestOutputHelper testOutputHelper )
20+ public WriterUnitTests ( )
2321 {
24- _testOutputHelper = testOutputHelper ;
2522 _mockIDriver . Setup ( driver => driver . BidirectionalStreamCall (
2623 It . IsAny < Method < FromClient , StreamWriteMessage . Types . FromServer > > ( ) ,
2724 It . IsAny < GrpcRequestSettings > ( ) )
@@ -317,68 +314,6 @@ public async Task Initialize_WhenNotSupportedCodec_ThrowWriterExceptionOnWriteAs
317314 _mockStream . Verify ( stream => stream . MoveNextAsync ( ) , Times . Once ) ;
318315 }
319316
320- // [Fact]
321- // public async Task WriteAsyncStress_WhenBufferIsOverflow_ThrowException()
322- // {
323- // const int countBatchSendingSize = 1000;
324- // const int batchTasksSize = 100;
325- // const int bufferSize = 100;
326- // const int messageSize = sizeof(int);
327- //
328- // Assert.True(batchTasksSize > bufferSize / 4);
329- // Assert.True(bufferSize % 4 == 0);
330- //
331- // var taskSource = new TaskCompletionSource<bool>();
332- // _mockStream.Setup(stream => stream.Write(It.IsAny<FromClient>()))
333- // .Returns(Task.CompletedTask);
334- // _mockStream.SetupSequence(stream => stream.MoveNextAsync())
335- // .Returns(new ValueTask<bool>(true))
336- // .Returns(new ValueTask<bool>(taskSource.Task));
337- // using var writer = new WriterBuilder<int>(_mockIDriver.Object, "/topic")
338- // {
339- // ProducerId = "producerId",
340- // BufferMaxSize = bufferSize /* bytes */
341- // }.Build();
342- //
343- // for (var attempt = 0; attempt < countBatchSendingSize; attempt++)
344- // {
345- // _testOutputHelper.WriteLine($"Processing attempt {attempt}");
346- // var cts = new CancellationTokenSource();
347- // cts.CancelAfter(10);
348- //
349- // var tasks = new List<Task<WriteResult>>();
350- //
351- // for (var i = 0; i < batchTasksSize; i++)
352- // {
353- // tasks.Add(writer.WriteAsync(100, cts.Token));
354- // }
355- //
356- // var countErrorCancel = 0;
357- // var countErrorBuffer = 0;
358- // foreach (var task in tasks)
359- // {
360- // try
361- // {
362- // await task;
363- // }
364- // catch (WriterException e)
365- // {
366- // if ("Buffer overflow" == e.Message)
367- // {
368- // countErrorBuffer++;
369- // }
370- // else
371- // {
372- // countErrorCancel++;
373- // }
374- // }
375- // }
376- //
377- // Assert.Equal(bufferSize / messageSize, countErrorCancel);
378- // Assert.Equal(batchTasksSize - bufferSize / messageSize, countErrorBuffer);
379- // }
380- // }
381-
382317 /*
383318 * Performed invocations:
384319
0 commit comments