Skip to content

Commit fb25ec2

Browse files
authored
IGNITE-28820 Fix DeploymentTest.TestMissingJarsCauseProperException (#13278)
https://issues.apache.org/jira/browse/IGNITE-28820
1 parent a39e9cb commit fb25ec2

3 files changed

Lines changed: 30 additions & 14 deletions

File tree

modules/platforms/dotnet/Apache.Ignite.Core.Tests/DeploymentTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public void TestMissingJarsCauseProperException()
105105
Assert.AreEqual("ERROR: Apache.Ignite.Core.Common.IgniteException: Java class is not found " +
106106
"(did you set IGNITE_HOME environment variable?): " +
107107
"org/apache/ignite/internal/processors/platform/utils/PlatformUtils",
108-
reader.GetOutput().First());
108+
reader.GetOutputWithoutJavaWarnings().First());
109109
}
110110

111111
/// <summary>

modules/platforms/dotnet/Apache.Ignite.Core.Tests/ExecutableTest.cs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -327,17 +327,6 @@ public void TestXmlConfigurationCmd()
327327
[Test]
328328
public void TestInvalidCmdArgs()
329329
{
330-
var ignoredWarns = new[]
331-
{
332-
"WARNING: An illegal reflective access operation has occurred",
333-
"WARNING: Illegal reflective access by org.apache.ignite.internal.util.GridUnsafe$2 " +
334-
"(file:/C:/w/incubator-ignite/modules/core/target/classes/) to field java.nio.Buffer.address",
335-
"WARNING: Please consider reporting this to the maintainers of org.apache.ignite.internal.util." +
336-
"GridUnsafe$2",
337-
"WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations",
338-
"WARNING: All illegal access operations will be denied in a future release"
339-
};
340-
341330
Action<string, string> checkError = (args, err) =>
342331
{
343332
var reader = new ListDataReader();
@@ -347,8 +336,7 @@ public void TestInvalidCmdArgs()
347336
Assert.IsTrue(proc.Join(30000, out exitCode));
348337
Assert.AreEqual(-1, exitCode);
349338

350-
Assert.AreEqual(err, reader.GetOutput()
351-
.Except(ignoredWarns)
339+
Assert.AreEqual(err, reader.GetOutputWithoutJavaWarnings()
352340
.FirstOrDefault(x => !string.IsNullOrWhiteSpace(x)));
353341
};
354342

modules/platforms/dotnet/Apache.Ignite.Core.Tests/Process/ListDataReader.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
namespace Apache.Ignite.Core.Tests.Process
1919
{
20+
using System;
2021
using System.Collections.Generic;
2122
using System.Diagnostics;
2223
using System.Linq;
@@ -26,6 +27,17 @@ namespace Apache.Ignite.Core.Tests.Process
2627
/// </summary>
2728
public class ListDataReader : IIgniteProcessOutputReader
2829
{
30+
/** JVM warnings that can appear before the actual Apache.Ignite.exe output. */
31+
private static readonly string[] IgnoredJavaWarnings =
32+
{
33+
"OpenJDK 64-Bit Server VM warning: Ignoring option --illegal-access=permit; support was removed in 17.0",
34+
"WARNING: An illegal reflective access operation has occurred",
35+
"WARNING: Illegal reflective access by org.apache.ignite.internal.util.GridUnsafe$2",
36+
"WARNING: Please consider reporting this to the maintainers of org.apache.ignite.internal.util.GridUnsafe$2",
37+
"WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations",
38+
"WARNING: All illegal access operations will be denied in a future release"
39+
};
40+
2941
/** Target list. */
3042
private readonly List<string> _list = new List<string>();
3143

@@ -53,5 +65,21 @@ public IList<string> GetOutput()
5365
return _list.ToList();
5466
}
5567
}
68+
69+
/// <summary>
70+
/// Gets the output without known JVM warnings.
71+
/// </summary>
72+
public IList<string> GetOutputWithoutJavaWarnings()
73+
{
74+
return GetOutput().Where(x => !IsIgnoredJavaWarning(x)).ToList();
75+
}
76+
77+
/// <summary>
78+
/// Returns a value indicating whether provided message is a known JVM warning.
79+
/// </summary>
80+
private static bool IsIgnoredJavaWarning(string message)
81+
{
82+
return IgnoredJavaWarnings.Any(warning => message.StartsWith(warning, StringComparison.Ordinal));
83+
}
5684
}
5785
}

0 commit comments

Comments
 (0)