@Test
public void testAffinityCallWithRetriesPositive() {

    ClusterNode node = grid(1).cluster().localNode();
    String firstCacheName = "CACHE_1_" + UUID.randomUUID();
    String secondCacheName = "CACHE_2_" + UUID.randomUUID();
    CacheConfiguration<Integer, Integer> cacheConfiguration1 = new CacheConfiguration<>();
    cacheConfiguration1.setName(firstCacheName);
    cacheConfiguration1.setAffinity(new TestAffinityFunction(node));
    IgniteCache<Integer, Integer> cache1 = ignite.createCache(cacheConfiguration1);
    CacheConfiguration<Integer, Integer> cacheConfiguration2 = new CacheConfiguration<>();
    cacheConfiguration2.setName(secondCacheName);
    cacheConfiguration2.setAffinity(new TestAffinityFunction(node));
    IgniteCache<Integer, Integer> cache2 = ignite.createCache(cacheConfiguration2);
    try (IgniteAtomicLong cnt = ignite.atomicLong("COUNTER_" + UUID.randomUUID(), 0, true)) {
        ComputeUtils.affinityCallWithRetries(ignite, Arrays.asList(firstCacheName, secondCacheName), part -> {
            Ignite locIgnite = Ignition.localIgnite();
            assertEquals(node, locIgnite.cluster().localNode());
            cnt.incrementAndGet();
            return part;
        }, 0, DeployingContext.unitialized());
        assertEquals(1, cnt.get());
    }
    finally {
        cache1.destroy();
        cache2.destroy();
    }
}