.NET: Fix ServicesTest flakiness
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/cc6c5e7e Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/cc6c5e7e Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/cc6c5e7e Branch: refs/heads/ignite-2.3 Commit: cc6c5e7e41fdb9c0af9d75add9177a658aecc6dd Parents: 0077076 Author: Pavel Tupitsyn <[email protected]> Authored: Thu Sep 28 13:13:39 2017 +0300 Committer: Pavel Tupitsyn <[email protected]> Committed: Thu Sep 28 13:13:39 2017 +0300 ---------------------------------------------------------------------- .../Apache.Ignite.Core.Tests/Services/ServicesTest.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/cc6c5e7e/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 ae36bcd..04f968c 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServicesTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServicesTest.cs @@ -19,6 +19,7 @@ namespace Apache.Ignite.Core.Tests.Services { using System; using System.Collections; + using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Threading; @@ -545,6 +546,7 @@ namespace Apache.Ignite.Core.Tests.Services var ex = Assert.Throws<ServiceDeploymentException>(() => Services.DeployMultiple(SvcName, svc, Grids.Length, 1)); + Assert.IsNotNull(ex.InnerException); Assert.AreEqual("Expected exception", ex.InnerException.Message); var svc0 = Services.GetService<TestIgniteServiceSerializable>(SvcName); @@ -705,11 +707,12 @@ namespace Apache.Ignite.Core.Tests.Services /// </summary> private static void CheckServiceStarted(IIgnite grid, int count = 1) { - var services = grid.GetServices().GetServices<TestIgniteServiceSerializable>(SvcName); + Func<ICollection<TestIgniteServiceSerializable>> getServices = () => + grid.GetServices().GetServices<TestIgniteServiceSerializable>(SvcName); - Assert.AreEqual(count, services.Count); + Assert.IsTrue(TestUtils.WaitForCondition(() => count == getServices().Count, 5000)); - var svc = services.First(); + var svc = getServices().First(); Assert.IsNotNull(svc);
