.NET: Fix flaky tests - improve assertions
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c4d67d2a Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c4d67d2a Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c4d67d2a Branch: refs/heads/ignite-3477 Commit: c4d67d2ab737c398c9158dfeb67dc979f5c052af Parents: 87fbb27 Author: Pavel Tupitsyn <ptupit...@apache.org> Authored: Tue Jan 10 16:07:36 2017 +0300 Committer: Pavel Tupitsyn <ptupit...@apache.org> Committed: Tue Jan 10 16:07:36 2017 +0300 ---------------------------------------------------------------------- .../dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs | 2 ++ .../platforms/dotnet/Apache.Ignite.Core.Tests/MessagingTest.cs | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/c4d67d2a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs index 250f974..1239794 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs @@ -309,6 +309,8 @@ namespace Apache.Ignite.Core.Tests.Cache Ignition.Start(cfg); } + + Assert.AreEqual(GridCount(), GetIgnite(0).GetCluster().GetNodes().Count); } /// <summary> http://git-wip-us.apache.org/repos/asf/ignite/blob/c4d67d2a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/MessagingTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/MessagingTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/MessagingTest.cs index 82c6742..8b57c81 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/MessagingTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/MessagingTest.cs @@ -56,6 +56,8 @@ namespace Apache.Ignite.Core.Tests _grid1 = Ignition.Start(Configuration("config\\compute\\compute-grid1.xml")); _grid2 = Ignition.Start(Configuration("config\\compute\\compute-grid2.xml")); _grid3 = Ignition.Start(Configuration("config\\compute\\compute-grid3.xml")); + + Assert.AreEqual(3, _grid1.GetCluster().GetNodes().Count); } /// <summary> @@ -556,7 +558,9 @@ namespace Apache.Ignite.Core.Tests Func<IEnumerable<string>, IEnumerable<string>> resultFunc, int expectedRepeat) { // check if expected message count has been received; Wait returns false if there were none. - Assert.IsTrue(ReceivedEvent.Wait(MessageTimeout)); + Assert.IsTrue(ReceivedEvent.Wait(MessageTimeout), + string.Format("expectedMessages: {0}, expectedRepeat: {1}, remaining: {2}", + expectedMessages, expectedRepeat, ReceivedEvent.CurrentCount)); expectedMessages = expectedMessages.SelectMany(x => Enumerable.Repeat(x, expectedRepeat));