Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id F1E1C200BF8 for ; Thu, 8 Dec 2016 11:54:55 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id F0924160B1E; Thu, 8 Dec 2016 10:54:55 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id EFC78160B30 for ; Thu, 8 Dec 2016 11:54:54 +0100 (CET) Received: (qmail 62433 invoked by uid 500); 8 Dec 2016 10:54:54 -0000 Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list commits@ignite.apache.org Received: (qmail 62364 invoked by uid 99); 8 Dec 2016 10:54:54 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Dec 2016 10:54:54 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id C82ABF1751; Thu, 8 Dec 2016 10:54:53 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sboikov@apache.org To: commits@ignite.apache.org Date: Thu, 08 Dec 2016 10:54:54 -0000 Message-Id: <9e70ba751a2d420fbfb0f355f3cc2de7@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [2/7] ignite git commit: IGNITE-4367 .NET: Fix flaky tests archived-at: Thu, 08 Dec 2016 10:54:56 -0000 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 Authored: Wed Dec 7 18:28:45 2016 +0300 Committer: Pavel Tupitsyn 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(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(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; + } + } } /// 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(); + /** */ public int TestProperty { get; set; } @@ -807,41 +810,50 @@ namespace Apache.Ignite.Core.Tests.Services /** */ 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; + } } /** */ 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; + } } /** */ 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; + } } /// 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"];