ignite-gg-12138 stop nodes after test + small test refactoring
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/54beab99 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/54beab99 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/54beab99 Branch: refs/heads/ignite-5075-pds Commit: 54beab99c12762a53f539f68bf1003ebf9ea3e85 Parents: dc3450e Author: Dmitriy Govorukhin <[email protected]> Authored: Thu May 25 20:19:22 2017 +0300 Committer: Dmitriy Govorukhin <[email protected]> Committed: Thu May 25 20:19:22 2017 +0300 ---------------------------------------------------------------------- .../internal/binary/BinaryObjectExceptionSelfTest.java | 10 ++++++++-- .../ipfinder/TcpDiscoveryIpFinderAbstractSelfTest.java | 7 +++++++ .../tcp/ipfinder/vm/TcpDiscoveryVmIpFinderSelfTest.java | 7 +++++-- 3 files changed, 20 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/54beab99/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryObjectExceptionSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryObjectExceptionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryObjectExceptionSelfTest.java index e4be824..35756a4 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryObjectExceptionSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryObjectExceptionSelfTest.java @@ -45,6 +45,9 @@ public class BinaryObjectExceptionSelfTest extends GridCommonAbstractTest { /** */ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true); + /** Cache name. */ + private final String cacheName = "cache"; + /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); @@ -52,7 +55,10 @@ public class BinaryObjectExceptionSelfTest extends GridCommonAbstractTest { cfg.setMarshaller(new BinaryMarshaller()); cfg.setDiscoverySpi(new TcpDiscoverySpi().setIpFinder(IP_FINDER)); - cfg.setCacheConfiguration(new CacheConfiguration().setCopyOnRead(true)); + cfg.setCacheConfiguration( + new CacheConfiguration(cacheName) + .setCopyOnRead(true) + ); BinaryConfiguration bcfg = new BinaryConfiguration(); @@ -84,7 +90,7 @@ public class BinaryObjectExceptionSelfTest extends GridCommonAbstractTest { public void testUnexpectedFieldType() throws Exception { IgniteEx grid = grid(0); - IgniteCache<String, Value> cache = grid.cache(null); + IgniteCache<String, Value> cache = grid.cache(cacheName); cache.put(TEST_KEY, new Value()); http://git-wip-us.apache.org/repos/asf/ignite/blob/54beab99/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/TcpDiscoveryIpFinderAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/TcpDiscoveryIpFinderAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/TcpDiscoveryIpFinderAbstractSelfTest.java index 6f2201f..465b38d 100644 --- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/TcpDiscoveryIpFinderAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/TcpDiscoveryIpFinderAbstractSelfTest.java @@ -54,6 +54,13 @@ public abstract class TcpDiscoveryIpFinderAbstractSelfTest<T extends TcpDiscover injectLogger(finder); } + /** {@inheritDoc} */ + @Override protected void afterTest() throws Exception { + super.afterTest(); + + stopAllGrids(); + } + /** * @throws Exception If any error occurs. */ http://git-wip-us.apache.org/repos/asf/ignite/blob/54beab99/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/vm/TcpDiscoveryVmIpFinderSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/vm/TcpDiscoveryVmIpFinderSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/vm/TcpDiscoveryVmIpFinderSelfTest.java index 25cb083..acc12c2 100644 --- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/vm/TcpDiscoveryVmIpFinderSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/vm/TcpDiscoveryVmIpFinderSelfTest.java @@ -223,6 +223,7 @@ public class TcpDiscoveryVmIpFinderSelfTest Ignition.stop("client1", true); Ignition.stop("client2", true); + Ignition.stop("client3", true); assertEquals(3 * srvSize, IP_FINDER.getRegisteredAddresses().size()); @@ -237,12 +238,14 @@ public class TcpDiscoveryVmIpFinderSelfTest Ignition.stop("server1", true); Ignition.stop("server2", true); - GridTestUtils.waitForCondition(new GridAbsPredicate() { + boolean res = GridTestUtils.waitForCondition(new GridAbsPredicate() { @Override public boolean apply() { - return 0 == G.allGrids().size(); + return G.allGrids().isEmpty(); } }, 10000); + assertTrue(res); + assertTrue(3 * srvSize >= IP_FINDER.getRegisteredAddresses().size()); }
