ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vkuliche...@apache.org
Subject [03/21] ignite git commit: Backported test fixes.
Date Tue, 19 Jul 2016 01:27:12 GMT
Backported test fixes.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/5b6e7816
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5b6e7816
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5b6e7816

Branch: refs/heads/ignite-3470
Commit: 5b6e7816260addfb3ed819e63147a0873bda9baf
Parents: f52fb79
Author: sboikov <sboikov@gridgain.com>
Authored: Thu Jul 7 12:37:25 2016 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Thu Jul 7 12:37:25 2016 +0300

----------------------------------------------------------------------
 .../GridEventStorageCheckAllEventsSelfTest.java | 30 ++++++++++++++++++--
 ...CommunicationRecoveryAckClosureSelfTest.java | 18 ++++++++++++
 2 files changed, 46 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/5b6e7816/modules/core/src/test/java/org/apache/ignite/internal/GridEventStorageCheckAllEventsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridEventStorageCheckAllEventsSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/GridEventStorageCheckAllEventsSelfTest.java
index ad15894..0619391 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridEventStorageCheckAllEventsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridEventStorageCheckAllEventsSelfTest.java
@@ -30,10 +30,12 @@ import org.apache.ignite.compute.ComputeJob;
 import org.apache.ignite.compute.ComputeJobAdapter;
 import org.apache.ignite.compute.ComputeJobResult;
 import org.apache.ignite.compute.ComputeTaskFuture;
+import org.apache.ignite.compute.ComputeTaskMapAsync;
 import org.apache.ignite.compute.ComputeTaskSession;
 import org.apache.ignite.compute.ComputeTaskSessionFullSupport;
 import org.apache.ignite.compute.ComputeTaskSplitAdapter;
 import org.apache.ignite.compute.ComputeTaskTimeoutException;
+import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.events.CheckpointEvent;
 import org.apache.ignite.events.DeploymentEvent;
 import org.apache.ignite.events.Event;
@@ -86,6 +88,16 @@ public class GridEventStorageCheckAllEventsSelfTest extends GridCommonAbstractTe
     }
 
     /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration() throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration();
+
+        // TODO: IGNITE-3099 (hotfix the test to check the event order in common case).
+        cfg.setPublicThreadPoolSize(1);
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
     @Override protected void beforeTestsStarted() throws Exception {
         ignite = G.ignite(getTestGridName());
 
@@ -140,10 +152,23 @@ public class GridEventStorageCheckAllEventsSelfTest extends GridCommonAbstractTe
      * @throws Exception If test failed.
      */
     public void testTaskUndeployEvents() throws Exception {
-        long tstamp = startTimestamp();
+        final long tstamp = startTimestamp();
 
         generateEvents(null, new GridAllEventsSuccessTestJob()).get();
 
+        // TODO: IGNITE-3099 (hotfix the test to check the event order in common case).
+        GridTestUtils.waitForCondition(new GridAbsPredicate() {
+            @Override public boolean apply() {
+                try {
+                    List<Event> evts = pullEvents(tstamp, 10);
+                    return evts.get(evts.size() - 1).type() == EVT_JOB_FINISHED;
+                }
+                catch (Exception e) {
+                    return false;
+                }
+            }
+        }, 500);
+
         ignite.compute().undeployTask(GridAllEventsTestTask.class.getName());
         ignite.compute().localDeployTask(GridAllEventsTestTask.class, GridAllEventsTestTask.class.getClassLoader());
 
@@ -198,7 +223,7 @@ public class GridEventStorageCheckAllEventsSelfTest extends GridCommonAbstractTe
         try {
             fut.get();
 
-            assert false : "Grid with locally executed job with timeout should throw GridComputeTaskTimeoutException.";
+            assert false : "Grid with locally executed job with timeout should throw ComputeTaskTimeoutException.";
         }
         catch (IgniteException e) {
             info("Expected exception caught [taskFuture=" + fut + ", exception=" + e + ']');
@@ -463,6 +488,7 @@ public class GridEventStorageCheckAllEventsSelfTest extends GridCommonAbstractTe
      *
      */
     @ComputeTaskSessionFullSupport
+    @ComputeTaskMapAsync // TODO: IGNITE-3099 (hotfix the test to check the event order in
common case).
     private static class GridAllEventsTestTask extends ComputeTaskSplitAdapter<Object,
Object> {
         /** {@inheritDoc} */
         @Override protected Collection<? extends ComputeJob> split(int gridSize, Object
arg) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/5b6e7816/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteTcpCommunicationRecoveryAckClosureSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteTcpCommunicationRecoveryAckClosureSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteTcpCommunicationRecoveryAckClosureSelfTest.java
index 7521f2e..260bbd2 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteTcpCommunicationRecoveryAckClosureSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteTcpCommunicationRecoveryAckClosureSelfTest.java
@@ -49,11 +49,13 @@ import org.apache.ignite.testframework.GridTestNode;
 import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.IgniteTestResources;
 import org.apache.ignite.testframework.junits.spi.GridSpiAbstractTest;
+import org.apache.ignite.testframework.junits.spi.GridSpiTest;
 import org.eclipse.jetty.util.ConcurrentHashSet;
 
 /**
  *
  */
+@GridSpiTest(spi = TcpCommunicationSpi.class, group = "Communication SPI")
 public class IgniteTcpCommunicationRecoveryAckClosureSelfTest<T extends CommunicationSpi>
     extends GridSpiAbstractTest<T> {
     /** */
@@ -151,6 +153,8 @@ public class IgniteTcpCommunicationRecoveryAckClosureSelfTest<T extends
Communic
 
             int expMsgs = 0;
 
+            long totAcked = 0;
+
             for (int i = 0; i < 5; i++) {
                 info("Iteration: " + i);
 
@@ -172,6 +176,8 @@ public class IgniteTcpCommunicationRecoveryAckClosureSelfTest<T extends
Communic
 
                 expMsgs += msgPerIter;
 
+                final long totAcked0 = totAcked;
+
                 for (TcpCommunicationSpi spi : spis) {
                     GridNioServer srv = U.field(spi, "nioSrvr");
 
@@ -189,6 +195,14 @@ public class IgniteTcpCommunicationRecoveryAckClosureSelfTest<T extends
Communic
 
                             GridTestUtils.waitForCondition(new GridAbsPredicate() {
                                 @Override public boolean apply() {
+                                    long acked = GridTestUtils.getFieldValue(recoveryDesc,
"acked");
+
+                                    return acked > totAcked0;
+                                }
+                            }, 5000);
+
+                            GridTestUtils.waitForCondition(new GridAbsPredicate() {
+                                @Override public boolean apply() {
                                     return recoveryDesc.messagesFutures().isEmpty();
                                 }
                             }, 10_000);
@@ -218,6 +232,8 @@ public class IgniteTcpCommunicationRecoveryAckClosureSelfTest<T extends
Communic
                 }
 
                 assertEquals(msgPerIter * 2, ackMsgs.get());
+
+                totAcked += msgPerIter;
             }
         }
         finally {
@@ -337,6 +353,8 @@ public class IgniteTcpCommunicationRecoveryAckClosureSelfTest<T extends
Communic
                 return expMsgs == ackMsgs.get();
             }
         }, 5000);
+
+        assertEquals(expMsgs, ackMsgs.get());
     }
 
     /**


Mime
View raw message