xtern commented on a change in pull request #9446:
URL: https://github.com/apache/ignite/pull/9446#discussion_r726037186



##########
File path: 
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java
##########
@@ -1429,52 +1431,80 @@ public void testInvokeAllAsyncMultipleKeysAvgTime() 
throws IgniteCheckedExceptio
 
     /** */
     @Test
-    public void testGetTime() {
+    public void testGetTime() throws Exception {
         IgniteCache<Integer, Integer> cache = 
grid(0).cache(DEFAULT_CACHE_NAME);
 
-        HistogramMetricImpl m = metric("GetTime");
+        HistogramMetricImpl getTime = metric("GetTime");
+        HistogramMetricImpl getAllTime = metric("GetAllTime");
 
-        assertTrue(Arrays.stream(m.value()).allMatch(v -> v == 0));
+        assertTrue(Arrays.stream(getTime.value()).allMatch(v -> v == 0));
+        assertTrue(Arrays.stream(getAllTime.value()).allMatch(v -> v == 0));
 
-        cache.put(1, 1);
+        cache.get(1);
+        cache.getAsync(1).get();
 
-        assertTrue(Arrays.stream(m.value()).allMatch(v -> v == 0));
+        assertTrue(waitForCondition(() -> Arrays.stream(getTime.value()).sum() 
== 2, getTestTimeout()));
+        assertEquals(0, Arrays.stream(getAllTime.value()).sum());
 
-        cache.get(1);
+        cache.getAll(Collections.singleton(1));
+        cache.getAllAsync(Collections.singleton(1)).get();
 
-        assertEquals(1, Arrays.stream(m.value()).filter(v -> v == 1).count());
+        assertTrue(waitForCondition(() -> 
Arrays.stream(getAllTime.value()).sum() == 2, getTestTimeout()));
+        assertEquals(2, Arrays.stream(getTime.value()).sum());
     }
 
     /** */
     @Test
-    public void testPutTime() {
+    public void testPutTime() throws Exception {
         IgniteCache<Integer, Integer> cache = 
grid(0).cache(DEFAULT_CACHE_NAME);
 
-        HistogramMetricImpl m = metric("PutTime");
+        HistogramMetricImpl putTime = metric("PutTime");
+        HistogramMetricImpl putAllTime = metric("PutAllTime");
 
-        assertTrue(Arrays.stream(m.value()).allMatch(v -> v == 0));
+        assertTrue(Arrays.stream(putTime.value()).allMatch(v -> v == 0));

Review comment:
       It might be better to replace allMatch with sum() == 0, because you 
check then sum() == 2.
   Moreover, it might be better to extract Arrays.stream().sum condition into a 
separate method/closure sum.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to