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 f90b2070a2 IGNITE-22794 .NET: Fix TestMicrosoftConsoleLogger flakiness 
(#4241)
f90b2070a2 is described below

commit f90b2070a23a155e23ff4cc9ffd4099cc4064433
Author: Pavel Tupitsyn <[email protected]>
AuthorDate: Fri Aug 16 18:06:51 2024 +0300

    IGNITE-22794 .NET: Fix TestMicrosoftConsoleLogger flakiness (#4241)
    
    Close synchronized writer to avoid race condition while accessing results.
---
 .../platforms/dotnet/Apache.Ignite.Tests/LoggingTests.cs   | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/modules/platforms/dotnet/Apache.Ignite.Tests/LoggingTests.cs 
b/modules/platforms/dotnet/Apache.Ignite.Tests/LoggingTests.cs
index e7266f0ad4..8a6bf92335 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Tests/LoggingTests.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Tests/LoggingTests.cs
@@ -74,9 +74,10 @@ public class LoggingTests
     [Test]
     public async Task TestMicrosoftConsoleLogger()
     {
-        var oldWriter = Console.Out;
-        var writer = new StringWriter();
-        Console.SetOut(TextWriter.Synchronized(writer));
+        var oldTextWriter = Console.Out;
+        var stringWriter = new StringWriter();
+        var textWriter = TextWriter.Synchronized(stringWriter);
+        Console.SetOut(textWriter);
 
         try
         {
@@ -93,12 +94,13 @@ public class LoggingTests
         }
         finally
         {
-            Console.SetOut(oldWriter);
+            Console.SetOut(oldTextWriter);
         }
 
         // Prevent further writes before accessing the inner StringBuilder.
-        writer.Close();
-        var log = writer.ToString();
+        textWriter.Close();
+        stringWriter.Close();
+        var log = stringWriter.ToString();
 
         StringAssert.Contains("dbug: Apache.Ignite.Internal.ClientSocket", 
log);
         StringAssert.Contains("Connection established", log);

Reply via email to