You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2016/12/08 10:54:54 UTC
[2/7] ignite git commit: IGNITE-4367 .NET: Fix flaky tests
IGNITE-4367 .NET: Fix flaky tests
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7b50a251
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7b50a251
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7b50a251
Branch: refs/heads/ignite-comm-balance-master
Commit: 7b50a25133e2fa2539d30de5dcfe26e66d38f3a0
Parents: 3ab5a2f
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Wed Dec 7 18:28:45 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Wed Dec 7 18:28:45 2016 +0300
----------------------------------------------------------------------
.../Binary/BinaryCompactFooterInteropTest.cs | 31 ++++++++++---
.../Apache.Ignite.Core.Tests/ExecutableTest.cs | 2 +-
.../Apache.Ignite.Core.Tests/ReconnectTest.cs | 4 +-
.../Services/ServicesTest.cs | 46 ++++++++++++--------
.../EntityFrameworkCacheTest.cs | 6 +--
5 files changed, 61 insertions(+), 28 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/7b50a251/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryCompactFooterInteropTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryCompactFooterInteropTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryCompactFooterInteropTest.cs
index 27b97fd..830e7f4 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryCompactFooterInteropTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryCompactFooterInteropTest.cs
@@ -17,6 +17,7 @@
namespace Apache.Ignite.Core.Tests.Binary
{
+ using System;
using System.Collections;
using System.Linq;
using Apache.Ignite.Core.Binary;
@@ -63,12 +64,30 @@ namespace Apache.Ignite.Core.Tests.Binary
[Test]
public void TestFromJava([Values(true, false)] bool client)
{
- var grid = client ? _clientGrid : _grid;
-
- var fromJava = grid.GetCompute().ExecuteJavaTask<PlatformComputeBinarizable>(ComputeApiTest.EchoTask,
- ComputeApiTest.EchoTypeBinarizable);
-
- Assert.AreEqual(1, fromJava.Field);
+ // Retry multiple times: IGNITE-4377
+ for (int i = 0; i < 10; i++)
+ {
+ var grid = client ? _clientGrid : _grid;
+
+ try
+ {
+ var fromJava = grid.GetCompute().ExecuteJavaTask<PlatformComputeBinarizable>(ComputeApiTest.EchoTask,
+ ComputeApiTest.EchoTypeBinarizable);
+
+ Assert.AreEqual(1, fromJava.Field);
+
+ return;
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("TestFromJava failed on try {0}: \n {1}", i, ex);
+
+ if (i < 9)
+ continue;
+
+ throw;
+ }
+ }
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/7b50a251/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ExecutableTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ExecutableTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ExecutableTest.cs
index 3b24b2e..636e0fe 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ExecutableTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ExecutableTest.cs
@@ -321,7 +321,7 @@ namespace Apache.Ignite.Core.Tests
var proc = new IgniteProcess(reader, args);
int exitCode;
- Assert.IsTrue(proc.Join(3000, out exitCode));
+ Assert.IsTrue(proc.Join(30000, out exitCode));
Assert.AreEqual(-1, exitCode);
lock (reader.List)
http://git-wip-us.apache.org/repos/asf/ignite/blob/7b50a251/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ReconnectTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ReconnectTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ReconnectTest.cs
index 91e4c06..fdf64a3 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ReconnectTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ReconnectTest.cs
@@ -75,7 +75,7 @@ namespace Apache.Ignite.Core.Tests
Assert.IsTrue(ex.ClientReconnectTask.Result);
// Check the event args.
- Thread.Sleep(1); // Wait for event handler
+ Thread.Sleep(100); // Wait for event handler
Assert.IsNotNull(eventArgs);
Assert.IsTrue(eventArgs.HasClusterRestarted);
@@ -148,6 +148,8 @@ namespace Apache.Ignite.Core.Tests
Assert.AreEqual(1, cache[1]);
Assert.AreEqual(1, disconnected);
+
+ Thread.Sleep(100); // Wait for event handler
Assert.AreEqual(1, reconnected);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7b50a251/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServicesTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServicesTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServicesTest.cs
index 0558d11..38a96bd 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServicesTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServicesTest.cs
@@ -762,6 +762,9 @@ namespace Apache.Ignite.Core.Tests.Services
[InstanceResource]
private IIgnite _grid;
+ /** */
+ private readonly object _syncRoot = new object();
+
/** <inheritdoc /> */
public int TestProperty { get; set; }
@@ -807,41 +810,50 @@ namespace Apache.Ignite.Core.Tests.Services
/** <inheritdoc /> */
public void Init(IServiceContext context)
{
- if (ThrowInit)
- throw new Exception("Expected exception");
+ lock (_syncRoot)
+ {
+ if (ThrowInit)
+ throw new Exception("Expected exception");
- CheckContext(context);
+ CheckContext(context);
- Assert.IsFalse(context.IsCancelled);
- Initialized = true;
+ Assert.IsFalse(context.IsCancelled);
+ Initialized = true;
+ }
}
/** <inheritdoc /> */
public void Execute(IServiceContext context)
{
- if (ThrowExecute)
- throw new Exception("Expected exception");
+ lock (_syncRoot)
+ {
+ if (ThrowExecute)
+ throw new Exception("Expected exception");
- CheckContext(context);
+ CheckContext(context);
- Assert.IsFalse(context.IsCancelled);
- Assert.IsTrue(Initialized);
- Assert.IsFalse(Cancelled);
+ Assert.IsFalse(context.IsCancelled);
+ Assert.IsTrue(Initialized);
+ Assert.IsFalse(Cancelled);
- Executed = true;
+ Executed = true;
+ }
}
/** <inheritdoc /> */
public void Cancel(IServiceContext context)
{
- if (ThrowCancel)
- throw new Exception("Expected exception");
+ lock (_syncRoot)
+ {
+ if (ThrowCancel)
+ throw new Exception("Expected exception");
- CheckContext(context);
+ CheckContext(context);
- Assert.IsTrue(context.IsCancelled);
+ Assert.IsTrue(context.IsCancelled);
- Cancelled = true;
+ Cancelled = true;
+ }
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/7b50a251/modules/platforms/dotnet/Apache.Ignite.EntityFramework.Tests/EntityFrameworkCacheTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.EntityFramework.Tests/EntityFrameworkCacheTest.cs b/modules/platforms/dotnet/Apache.Ignite.EntityFramework.Tests/EntityFrameworkCacheTest.cs
index 8b9f955..0e095f4 100644
--- a/modules/platforms/dotnet/Apache.Ignite.EntityFramework.Tests/EntityFrameworkCacheTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.EntityFramework.Tests/EntityFrameworkCacheTest.cs
@@ -662,10 +662,10 @@ namespace Apache.Ignite.EntityFramework.Tests
[Category(TestUtils.CategoryIntensive)]
public void TestOldEntriesCleanupMultithreaded()
{
- TestUtils.RunMultiThreaded(CreateRemoveBlog, 4, 10);
+ TestUtils.RunMultiThreaded(CreateRemoveBlog, 4, 5);
// Wait for the cleanup to complete.
- Thread.Sleep(500);
+ Thread.Sleep(2000);
// Only one version of data is in the cache.
Assert.AreEqual(1, _cache.GetSize());
@@ -700,7 +700,7 @@ namespace Apache.Ignite.EntityFramework.Tests
}
Interlocked.Increment(ref opCnt);
- }, 4, 10);
+ }, 4, 5);
var setVersion = _metaCache["Blog"];