Skip to content

Commit

Permalink
GG-21151 little test fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
ktkalenko committed Aug 15, 2019
1 parent 5d6cfe2 commit 2d69f2c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,8 @@
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.processors.cache.CacheGroupContext;
import org.apache.ignite.testframework.ListeningTestLogger;
import org.apache.ignite.testframework.junits.SystemPropertiesRule;
import org.apache.ignite.testframework.junits.WithSystemProperty;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.rules.TestRule;

import java.io.ByteArrayOutputStream;
import java.io.PrintWriter;
Expand All @@ -42,7 +38,10 @@
import java.util.Map;
import java.util.regex.Matcher;

import static java.lang.Boolean.FALSE;
import static java.lang.Boolean.TRUE;
import static java.lang.Integer.parseInt;
import static java.lang.System.setProperty;
import static java.util.Objects.nonNull;
import static java.util.function.Function.identity;
import static java.util.regex.Pattern.compile;
Expand All @@ -54,14 +53,8 @@
import static org.apache.ignite.IgniteSystemProperties.IGNITE_WRITE_REBALANCE_STATISTICS;
import static org.apache.ignite.testframework.GridTestUtils.assertNotContains;

@WithSystemProperty(key = IGNITE_QUIET, value = "false")
@WithSystemProperty(key = IGNITE_WRITE_REBALANCE_STATISTICS, value = "true")
@WithSystemProperty(key = IGNITE_WRITE_REBALANCE_PARTITION_STATISTICS, value = "true")
/** For testing of rebalance statistics. */
public class RebalanceStatisticsTest extends GridCommonAbstractTest {
/** Class rule. */
@ClassRule public static final TestRule classRule = new SystemPropertiesRule();

/** Cache names. */
private static final String[] DEFAULT_CACHE_NAMES = {"ch0", "ch1", "ch2", "ch3"};

Expand Down Expand Up @@ -104,6 +97,15 @@ public class RebalanceStatisticsTest extends GridCommonAbstractTest {
/** Coordinator. */
private IgniteEx crd;

/** {@inheritDoc} */
@Override protected void beforeTest() throws Exception {
setProperty(IGNITE_QUIET, FALSE.toString());
setProperty(IGNITE_WRITE_REBALANCE_STATISTICS, TRUE.toString());
setProperty(IGNITE_WRITE_REBALANCE_PARTITION_STATISTICS, TRUE.toString());

super.beforeTest();
}

/** {@inheritDoc} */
@Override protected void afterTest() throws Exception {
stopAllGrids();
Expand Down Expand Up @@ -152,9 +154,10 @@ private CacheConfiguration cacheConfiguration(final String cacheName, final int
* @see IgniteSystemProperties#IGNITE_WRITE_REBALANCE_STATISTICS
*/
@Test
@WithSystemProperty(key = IGNITE_QUIET, value = "true")
@WithSystemProperty(key = IGNITE_WRITE_REBALANCE_STATISTICS, value = "false")
public void testNotPrintStat() throws Exception {
setProperty(IGNITE_QUIET, TRUE.toString());
setProperty(IGNITE_WRITE_REBALANCE_STATISTICS, FALSE.toString());

cacheCfgs = defaultCacheConfigurations(10, 0);

crd = startGrids(DEFAULT_NODE_CNT);
Expand All @@ -167,7 +170,7 @@ public void testNotPrintStat() throws Exception {

assertNotContainsAfterCreateNewNode(nodeCnt++, TOTAL_INFORMATION_TEXT);

System.setProperty(IGNITE_QUIET, Boolean.FALSE.toString());
setProperty(IGNITE_QUIET, FALSE.toString());

assertNotContainsAfterCreateNewNode(nodeCnt++, TOTAL_INFORMATION_TEXT);
}
Expand All @@ -181,8 +184,9 @@ public void testNotPrintStat() throws Exception {
* @see IgniteSystemProperties#IGNITE_WRITE_REBALANCE_PARTITION_STATISTICS
*/
@Test
@WithSystemProperty(key = IGNITE_WRITE_REBALANCE_PARTITION_STATISTICS, value = "false")
public void testNotPrintPartitionDistribution() throws Exception {
setProperty(IGNITE_WRITE_REBALANCE_PARTITION_STATISTICS, FALSE.toString());

cacheCfgs = defaultCacheConfigurations(10, 0);

crd = startGrids(DEFAULT_NODE_CNT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,7 @@ public static TestSuite suite() throws Exception {

suite.addTestSuite(CacheRebalancingSelfTest.class);
suite.addTestSuite(CacheManualRebalancingTest.class);
GridTestUtils.addTestIfNeeded(suite, CacheRebalancingSelfTest.class, ignoredTests);
GridTestUtils.addTestIfNeeded(suite, CacheManualRebalancingTest.class, ignoredTests);
GridTestUtils.addTestIfNeeded(suite, RebalanceStatisticsTest.class, ignoredTests);
suite.addTestSuite(RebalanceStatisticsTest.class);

// Affinity tests.
suite.addTestSuite(GridCacheAffinityBackupsSelfTest.class);
Expand Down

0 comments on commit 2d69f2c

Please sign in to comment.