You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sd...@apache.org on 2022/10/28 12:01:36 UTC
[ignite-3] branch main updated: IGNITE-17966: Fix problem with stuck Gradle processes in .NET tests (#1258)
This is an automated email from the ASF dual-hosted git repository.
sdanilov 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 86f92aa949 IGNITE-17966: Fix problem with stuck Gradle processes in .NET tests (#1258)
86f92aa949 is described below
commit 86f92aa949d30eeddb2a9fd2eb0bfb991c8107bb
Author: Mikhail <Po...@users.noreply.github.com>
AuthorDate: Fri Oct 28 16:01:30 2022 +0400
IGNITE-17966: Fix problem with stuck Gradle processes in .NET tests (#1258)
---
.../apache/ignite/internal/TestHybridClock.java | 0
.../dotnet/Apache.Ignite.Tests/JavaServer.cs | 88 ++++------------------
modules/replicator/build.gradle | 1 +
3 files changed, 14 insertions(+), 75 deletions(-)
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/TestHybridClock.java b/modules/core/src/testFixtures/java/org/apache/ignite/internal/TestHybridClock.java
similarity index 100%
rename from modules/core/src/test/java/org/apache/ignite/internal/TestHybridClock.java
rename to modules/core/src/testFixtures/java/org/apache/ignite/internal/TestHybridClock.java
diff --git a/modules/platforms/dotnet/Apache.Ignite.Tests/JavaServer.cs b/modules/platforms/dotnet/Apache.Ignite.Tests/JavaServer.cs
index 077626b295..97b5592323 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Tests/JavaServer.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Tests/JavaServer.cs
@@ -35,16 +35,11 @@ namespace Apache.Ignite.Tests
private const int ConnectTimeoutSeconds = 120;
- /** Maven command to execute the main class. */
- private const string MavenCommandExec = "exec:java@platform-test-node-runner";
+ private const string GradleCommandExec = ":ignite-runner:runnerPlatformTest --no-daemon"
+ + " -x compileJava -x compileTestFixturesJava -x compileIntegrationTestJava -x compileTestJava";
- /** Maven arg to perform a dry run to ensure that code is compiled and all artifacts are downloaded. */
- private const string MavenCommandDryRunArg = " -Dexec.args=dry-run";
-
- /** Full path to Maven binary. */
- private static readonly string MavenPath = GetMaven();
-
- private static volatile bool _dryRunComplete;
+ /** Full path to Gradle binary. */
+ private static readonly string GradlePath = GetGradle();
private readonly Process? _process;
@@ -72,7 +67,6 @@ namespace Apache.Ignite.Tests
Log(">>> Java server is not detected, starting...");
- EnsureBuild();
var process = CreateProcess();
var evt = new ManualResetEventSlim(false);
@@ -124,54 +118,7 @@ namespace Apache.Ignite.Tests
Log(">>> Java server stopped.");
}
- /// <summary>
- /// Performs a dry run of the Maven executable to ensure that code is compiled and all artifacts are downloaded.
- /// Does not start the actual node.
- /// </summary>
- private static void EnsureBuild()
- {
- if (_dryRunComplete)
- {
- return;
- }
-
- using var process = CreateProcess(dryRun: true);
-
- DataReceivedEventHandler handler = (_, eventArgs) =>
- {
- var line = eventArgs.Data;
- if (line == null)
- {
- return;
- }
-
- Log(line);
- };
-
- process.OutputDataReceived += handler;
- process.ErrorDataReceived += handler;
-
- process.Start();
-
- process.BeginErrorReadLine();
- process.BeginOutputReadLine();
-
- // 5 min timeout for the build process (may take time to download artifacts on slow networks).
- if (!process.WaitForExit(5 * 60_000))
- {
- process.Kill();
- throw new Exception("Failed to wait for Maven exec dry run.");
- }
-
- if (process.ExitCode != 0)
- {
- throw new Exception($"Maven exec failed with code {process.ExitCode}, check log for details.");
- }
-
- _dryRunComplete = true;
- }
-
- private static Process CreateProcess(bool dryRun = false)
+ private static Process CreateProcess()
{
var file = TestUtils.IsWindows ? "cmd.exe" : "/bin/bash";
@@ -183,11 +130,11 @@ namespace Apache.Ignite.Tests
ArgumentList =
{
TestUtils.IsWindows ? "/c" : "-c",
- $"{MavenPath} {MavenCommandExec}" + (dryRun ? MavenCommandDryRunArg : string.Empty)
+ $"{GradlePath} {GradleCommandExec}"
},
CreateNoWindow = true,
UseShellExecute = false,
- WorkingDirectory = Path.Combine(TestUtils.RepoRootDir, "modules", "runner"),
+ WorkingDirectory = TestUtils.RepoRootDir,
RedirectStandardOutput = true,
RedirectStandardError = true
}
@@ -244,22 +191,13 @@ namespace Apache.Ignite.Tests
}
}
- /// <summary>
- /// Gets maven path.
- /// </summary>
- private static string GetMaven()
+ private static string GetGradle()
{
- var extensions = RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
- ? new[] {".cmd", ".bat"}
- : new[] {string.Empty};
-
- return new[] {"MAVEN_HOME", "M2_HOME", "M3_HOME", "MVN_HOME"}
- .Select(Environment.GetEnvironmentVariable)
- .Where(x => !string.IsNullOrEmpty(x))
- .Select(x => Path.Combine(x!, "bin", "mvn"))
- .SelectMany(x => extensions.Select(ext => x + ext))
- .Where(File.Exists)
- .FirstOrDefault() ?? "mvn";
+ var gradleWrapper = RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
+ ? "gradlew.bat"
+ : "gradlew";
+
+ return Path.Combine(TestUtils.RepoRootDir, gradleWrapper);
}
}
}
diff --git a/modules/replicator/build.gradle b/modules/replicator/build.gradle
index 5f4b43d3ba..1f9d57cc7f 100644
--- a/modules/replicator/build.gradle
+++ b/modules/replicator/build.gradle
@@ -24,6 +24,7 @@ dependencies {
annotationProcessor project(":ignite-network-annotation-processor")
implementation project(':ignite-core')
implementation project(':ignite-raft')
+ implementation project(':ignite-raft-client')
implementation project(':ignite-configuration')
implementation project(':ignite-network-api')
implementation libs.jetbrains.annotations