This is an automated email from the ASF dual-hosted git repository.
ptupitsyn pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git
The following commit(s) were added to refs/heads/main by this push:
new a98b7439d2 IGNITE-18184 .NET: Fix flaky pooled buffer leak check
(#1352)
a98b7439d2 is described below
commit a98b7439d2ee9e401501f067609e957a8ed9969c
Author: Pavel Tupitsyn <[email protected]>
AuthorDate: Thu Nov 17 16:10:34 2022 +0300
IGNITE-18184 .NET: Fix flaky pooled buffer leak check (#1352)
---
.../dotnet/Apache.Ignite.Tests/IgniteTestsBase.cs | 24 ++++++++++++----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/modules/platforms/dotnet/Apache.Ignite.Tests/IgniteTestsBase.cs
b/modules/platforms/dotnet/Apache.Ignite.Tests/IgniteTestsBase.cs
index e9cae77338..03712b777f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Tests/IgniteTestsBase.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Tests/IgniteTestsBase.cs
@@ -98,22 +98,13 @@ namespace Apache.Ignite.Tests
Assert.Greater(_eventListener.BuffersRented, 0);
- // Use WaitForCondition to check rented/returned buffers equality:
- // Buffer pools are used by everything, including testing
framework, internal .NET needs, etc.
- var listener = _eventListener;
- TestUtils.WaitForCondition(
- condition: () => listener.BuffersReturned ==
listener.BuffersRented,
- timeoutMs: 1000,
- messageFactory: () => $"rented = {listener.BuffersRented},
returned = {listener.BuffersReturned}");
+ CheckPooledBufferLeak();
_eventListener.Dispose();
}
[TearDown]
- public void TearDown()
- {
- Assert.AreEqual(_eventListener.BuffersReturned,
_eventListener.BuffersRented);
- }
+ public void TearDown() => CheckPooledBufferLeak();
protected static IIgniteTuple GetTuple(long id) => new IgniteTuple {
[KeyCol] = id };
@@ -130,5 +121,16 @@ namespace Apache.Ignite.Tests
Endpoints = { "127.0.0.1:" + ServerNode.Port },
Logger = new ConsoleLogger { MinLevel = LogLevel.Trace }
};
+
+ private void CheckPooledBufferLeak()
+ {
+ // Use WaitForCondition to check rented/returned buffers equality:
+ // Buffer pools are used by everything, including testing
framework, internal .NET needs, etc.
+ var listener = _eventListener;
+ TestUtils.WaitForCondition(
+ condition: () => listener.BuffersReturned ==
listener.BuffersRented,
+ timeoutMs: 1000,
+ messageFactory: () => $"rented = {listener.BuffersRented},
returned = {listener.BuffersReturned}");
+ }
}
}