Repository: ignite Updated Branches: refs/heads/master b3a964542 -> c96631968
IGNITE-10191 Fixed incorrect comparison of lists in RendezvousAffinityFunctionSimpleBenchmark.testAffinityCompatibility - Fixes #5460. Signed-off-by: Pavel Kovalenko <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c9663196 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c9663196 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c9663196 Branch: refs/heads/master Commit: c96631968e65b058f9e3795f01d6b3f510c4a5a3 Parents: b3a9645 Author: Oleg Ignatenko <[email protected]> Authored: Thu Nov 22 19:14:40 2018 +0300 Committer: Pavel Kovalenko <[email protected]> Committed: Thu Nov 22 19:14:40 2018 +0300 ---------------------------------------------------------------------- ...ndezvousAffinityFunctionSimpleBenchmark.java | 26 +++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/c9663196/modules/core/src/test/java/org/apache/ignite/cache/affinity/rendezvous/RendezvousAffinityFunctionSimpleBenchmark.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/cache/affinity/rendezvous/RendezvousAffinityFunctionSimpleBenchmark.java b/modules/core/src/test/java/org/apache/ignite/cache/affinity/rendezvous/RendezvousAffinityFunctionSimpleBenchmark.java index c680a68..452a1fb 100644 --- a/modules/core/src/test/java/org/apache/ignite/cache/affinity/rendezvous/RendezvousAffinityFunctionSimpleBenchmark.java +++ b/modules/core/src/test/java/org/apache/ignite/cache/affinity/rendezvous/RendezvousAffinityFunctionSimpleBenchmark.java @@ -548,23 +548,21 @@ public class RendezvousAffinityFunctionSimpleBenchmark extends GridCommonAbstrac /** * */ - public void _testAffinityCompatibility() { - mode = TopologyModificationMode.ADD; - + public void testAffinityCompatibility() { AffinityFunction aff0 = new RendezvousAffinityFunction(true, 1024); - // Use the full copy of the old implementaion of the RendezvousAffinityFunction to check the compatibility. + // Use the full copy of the old implementation of the RendezvousAffinityFunction to check the compatibility. AffinityFunction aff1 = new RendezvousAffinityFunctionOld(true, 1024); GridTestUtils.setFieldValue(aff1, "ignite", ignite); - affinityCompatibility(aff0, aff1); + structuralCompatibility(aff0, aff1); } /** * @param aff0 Affinity function to compare. * @param aff1 Affinity function to compare. */ - private void affinityCompatibility(AffinityFunction aff0, AffinityFunction aff1) { + private void structuralCompatibility(AffinityFunction aff0, AffinityFunction aff1) { int[] nodesCnts = {64, 100, 200, 300, 400, 500, 600}; final int backups = 2; @@ -574,14 +572,24 @@ public class RendezvousAffinityFunctionSimpleBenchmark extends GridCommonAbstrac for (int nodesCnt : nodesCnts) { List<ClusterNode> nodes = createBaseNodes(nodesCnt); - List<List<ClusterNode>> assignment0 = assignPartitions(aff0, nodes, null, backups, 0).get2(); + List<Integer> structure0 = structureOf(assignPartitions(aff0, nodes, null, backups, 0).get2()); - List<List<ClusterNode>> assignment1 = assignPartitions(aff1, nodes, null, backups, 0).get2(); + List<Integer> structure1 = structureOf(assignPartitions(aff1, nodes, null, backups, 0).get2()); - assertEquals (assignment0, assignment1); + assertEquals (structure0, structure1); } } + /** */ + private List<Integer> structureOf(List<List<ClusterNode>> assignment) { + List<Integer> res = new ArrayList<>(); + + for (List<ClusterNode> nodes : assignment) + res.add(nodes != null && !nodes.contains(null) ? nodes.size() : null); + + return res; + } + /** * */
