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 5bfad609412 IGNITE-26830 .NET: Fix 
Compatibility.CurrentClientWithOldServerCompatibilityTest (#6868)
5bfad609412 is described below

commit 5bfad60941272b446fc9e55fe4871c57bdb54a49
Author: Pavel Tupitsyn <[email protected]>
AuthorDate: Thu Oct 30 15:49:38 2025 +0200

    IGNITE-26830 .NET: Fix 
Compatibility.CurrentClientWithOldServerCompatibilityTest (#6868)
    
    * Retry `JavaServer` startup to work around "port in use" and other issues
    * Run compat tests on Linux only to speed up CI
    * Fix `TaskCompletionSource` and error handling
---
 .../CurrentClientWithOldServerCompatibilityTest.cs |  1 +
 .../dotnet/Apache.Ignite.Tests/JavaServer.cs       | 38 +++++++++++++++++++---
 2 files changed, 34 insertions(+), 5 deletions(-)

diff --git 
a/modules/platforms/dotnet/Apache.Ignite.Tests/Compatibility/CurrentClientWithOldServerCompatibilityTest.cs
 
b/modules/platforms/dotnet/Apache.Ignite.Tests/Compatibility/CurrentClientWithOldServerCompatibilityTest.cs
index a9fc4e62e34..6ff27fcd54f 100644
--- 
a/modules/platforms/dotnet/Apache.Ignite.Tests/Compatibility/CurrentClientWithOldServerCompatibilityTest.cs
+++ 
b/modules/platforms/dotnet/Apache.Ignite.Tests/Compatibility/CurrentClientWithOldServerCompatibilityTest.cs
@@ -34,6 +34,7 @@ using NUnit.Framework;
 using TestHelpers;
 
 [TestFixture("3.0.0")]
+[Platform("Linux", Reason = "Faster runs on CI")]
 public class CurrentClientWithOldServerCompatibilityTest
 {
     private const string TableNameTest = "TEST";
diff --git a/modules/platforms/dotnet/Apache.Ignite.Tests/JavaServer.cs 
b/modules/platforms/dotnet/Apache.Ignite.Tests/JavaServer.cs
index 12d02b80233..47edcb3e62b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Tests/JavaServer.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Tests/JavaServer.cs
@@ -40,6 +40,8 @@ namespace Apache.Ignite.Tests
 
         private const int ConnectTimeoutSeconds = 4 * 60;
 
+        private const int MaxAttempts = 3;
+
         private const string GradleCommandExec = 
":ignite-runner:runnerPlatformTest --parallel";
 
         private const string GradleCommandExecOldServer = 
":ignite-compatibility-tests:runnerPlatformCompatibilityTest --parallel";
@@ -64,14 +66,14 @@ namespace Apache.Ignite.Tests
         /// Starts a server node.
         /// </summary>
         /// <returns>Disposable object to stop the server.</returns>
-        public static async Task<JavaServer> StartAsync() => await 
StartInternalAsync(old: false, env: [], defaultPort: 10942);
+        public static async Task<JavaServer> StartAsync() => await 
StartInternalAsyncWithRetry(old: false, env: [], defaultPort: 10942);
 
         public static async Task<JavaServer> StartOldAsync(string version, 
string workDir)
         {
             // Get random unused ports to avoid conflicts with other tests.
             var ports = GetUnusedPorts(3);
 
-            return await StartInternalAsync(
+            return await StartInternalAsyncWithRetry(
                 old: true,
                 env: new()
                 {
@@ -107,6 +109,31 @@ namespace Apache.Ignite.Tests
             Log(">>> Java server stopped.");
         }
 
+        private static async Task<JavaServer> StartInternalAsyncWithRetry(
+            bool old, Dictionary<string, string?> env, int? defaultPort = null)
+        {
+            int attempt = 0;
+
+            while (true)
+            {
+                try
+                {
+                    attempt++;
+                    return await StartInternalAsync(old, env, defaultPort);
+                }
+                catch (Exception e)
+                {
+                    if (attempt == MaxAttempts)
+                    {
+                        Log($">>> Java server start failed after {MaxAttempts} 
attempts.");
+                        throw;
+                    }
+
+                    Log($">>> Java server start attempt {attempt} failed: {e}. 
Retrying...");
+                }
+            }
+        }
+
         private static async Task<JavaServer> StartInternalAsync(bool old, 
Dictionary<string, string?> env, int? defaultPort = null)
         {
             string gradleCommand = old ? GradleCommandExecOldServer : 
GradleCommandExec;
@@ -145,13 +172,14 @@ namespace Apache.Ignite.Tests
                 if (line.StartsWith("THIN_CLIENT_PORTS", 
StringComparison.Ordinal))
                 {
                     var ports = 
line.Split('=').Last().Split(',').Select(int.Parse).OrderBy(x => x).ToArray();
-                    tcs.SetResult(ports);
+                    tcs.TrySetResult(ports);
                 }
 
-                if (line.StartsWith("Exception in thread \"main\"", 
StringComparison.OrdinalIgnoreCase))
+                if (line.StartsWith("Exception in thread \"main\"", 
StringComparison.OrdinalIgnoreCase) ||
+                    line.Contains("Unable to start", 
StringComparison.OrdinalIgnoreCase))
                 {
                     process.Kill(entireProcessTree: true);
-                    tcs.SetException(new Exception($"Java server failed: 
{line}"));
+                    tcs.TrySetException(new Exception($"Java server failed: 
{line}"));
                 }
             };
 

Reply via email to