Skip to content

Commit 74377f9

Browse files
disable flap test
1 parent 57f8a97 commit 74377f9

File tree

1 file changed

+61
-61
lines changed

1 file changed

+61
-61
lines changed

src/Ydb.Sdk/tests/Topic/WriterUnitTests.cs

Lines changed: 61 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -317,67 +317,67 @@ public async Task Initialize_WhenNotSupportedCodec_ThrowWriterExceptionOnWriteAs
317317
_mockStream.Verify(stream => stream.MoveNextAsync(), Times.Once);
318318
}
319319

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-
}
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+
// }
381381

382382
/*
383383
* Performed invocations:

0 commit comments

Comments
 (0)