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 2017/04/14 08:53:41 UTC

[47/50] [abbrv] ignite git commit: .NET: Fix metrics test (IGNITE-3018)

.NET: Fix metrics test (IGNITE-3018)


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/40347eda
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/40347eda
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/40347eda

Branch: refs/heads/ignite-4929
Commit: 40347eda88de4c48a2c0535e50a91c5bff683105
Parents: 428f66d
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Fri Apr 14 10:40:04 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Fri Apr 14 10:40:04 2017 +0300

----------------------------------------------------------------------
 .../Apache.Ignite.Core.Tests/Cache/CacheMetricsTest.cs | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/40347eda/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheMetricsTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheMetricsTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheMetricsTest.cs
index d1d6c7b..d12afd2 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheMetricsTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheMetricsTest.cs
@@ -25,6 +25,7 @@ namespace Apache.Ignite.Core.Tests.Cache
     using Apache.Ignite.Core.Impl;
     using Apache.Ignite.Core.Impl.Cache;
     using NUnit.Framework;
+    using System.Linq;
 
     /// <summary>
     /// Tests cache metrics propagation.
@@ -212,7 +213,8 @@ namespace Apache.Ignite.Core.Tests.Cache
         {
             func2 = func2 ?? func;
 
-            var localCache = Ignition.GetIgnite().CreateCache<int, int>(new CacheConfiguration(cacheName)
+            var localIgnite = Ignition.GetIgnite();
+            var localCache = localIgnite.CreateCache<int, int>(new CacheConfiguration(cacheName)
             {
                 EnableStatistics = true
             });
@@ -222,9 +224,12 @@ namespace Apache.Ignite.Core.Tests.Cache
             Assert.IsTrue(localCache.GetConfiguration().EnableStatistics);
             Assert.IsTrue(remoteCache.GetConfiguration().EnableStatistics);
 
-            localCache.Put(1, 1);
-            localCache.Get(1);
-            
+            var aff = localIgnite.GetAffinity(cacheName);
+            var localNode = localIgnite.GetCluster().GetLocalNode();
+            var localKey = Enumerable.Range(1, 10000).First(x => aff.IsPrimary(localNode, x));
+
+            localCache.Put(localKey, 1);
+            localCache.Get(localKey);
             // Wait for metrics to propagate.
             Thread.Sleep(TcpDiscoverySpi.DefaultHeartbeatFrequency);