From a24d854470caf2dcbdc3e41b168224e3212d13e5 Mon Sep 17 00:00:00 2001 From: Mohan Date: Tue, 10 Sep 2019 14:43:29 +0530 Subject: [PATCH 1/3] Reduce the probability of test failure --- .../java/io/siddhi/core/query/window/CronWindowTestCase.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/siddhi-core/src/test/java/io/siddhi/core/query/window/CronWindowTestCase.java b/modules/siddhi-core/src/test/java/io/siddhi/core/query/window/CronWindowTestCase.java index 455723c342..2c054e9093 100644 --- a/modules/siddhi-core/src/test/java/io/siddhi/core/query/window/CronWindowTestCase.java +++ b/modules/siddhi-core/src/test/java/io/siddhi/core/query/window/CronWindowTestCase.java @@ -23,6 +23,7 @@ import io.siddhi.core.stream.input.InputHandler; import io.siddhi.core.stream.output.StreamCallback; import io.siddhi.core.util.EventPrinter; +import io.siddhi.core.util.SiddhiTestHelper; import org.apache.log4j.Logger; import org.testng.AssertJUnit; import org.testng.annotations.BeforeMethod; @@ -126,7 +127,7 @@ public void receive(Event[] events) { Thread.sleep(7000); inputHandler.send(new Object[]{"IBM43", 700f, 0}); inputHandler.send(new Object[]{"WSO4343", 60.5f, 1}); - Thread.sleep(7000); + SiddhiTestHelper.waitForEvents(7000, 4, removeEventCount, 20000); AssertJUnit.assertEquals(4, removeEventCount); AssertJUnit.assertTrue(eventArrived); siddhiAppRuntime.shutdown(); From 4cd22c76ef723a4008bed4cbc762932a52c56968 Mon Sep 17 00:00:00 2001 From: Mohan Date: Tue, 10 Sep 2019 16:23:38 +0530 Subject: [PATCH 2/3] Reduce the probability of test failure --- .../pattern/absent/LogicalAbsentPatternTestCase.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/siddhi-core/src/test/java/io/siddhi/core/query/pattern/absent/LogicalAbsentPatternTestCase.java b/modules/siddhi-core/src/test/java/io/siddhi/core/query/pattern/absent/LogicalAbsentPatternTestCase.java index bda790bda0..04359f665d 100644 --- a/modules/siddhi-core/src/test/java/io/siddhi/core/query/pattern/absent/LogicalAbsentPatternTestCase.java +++ b/modules/siddhi-core/src/test/java/io/siddhi/core/query/pattern/absent/LogicalAbsentPatternTestCase.java @@ -1937,9 +1937,9 @@ public void testQueryAbsent47() throws InterruptedException { InputHandler stream3 = siddhiAppRuntime.getInputHandler("Stream3"); siddhiAppRuntime.start(); - Thread.sleep(2200); + Thread.sleep(2100); stream3.send(new Object[]{"WSO2", 35.0f, 100}); - Thread.sleep(2200); + Thread.sleep(2100); stream3.send(new Object[]{"IBM", 55.0f, 100}); Thread.sleep(1000); @@ -1952,9 +1952,9 @@ public void testQueryAbsent47() throws InterruptedException { siddhiAppRuntime.shutdown(); } - @Test(dependsOnMethods = {"testQueryAbsent47"}) + @Test //(dependsOnMethods = {"testQueryAbsent47"}) public void testQueryAbsent48() throws InterruptedException { - log.info("Test the query every (not e1 for 1 sec or not e2 for 1 sec) -> e3 with only e3 after 2 seconds"); + log.info("Test the query every (not e1 for 2 sec or not e2 for 2 sec) -> e3 with only e3 after 4 seconds"); SiddhiManager siddhiManager = new SiddhiManager(); @@ -1964,7 +1964,7 @@ public void testQueryAbsent48() throws InterruptedException { "define stream Stream3 (symbol string, price float, volume int); "; String query = "" + "@info(name = 'query1') " + - "from every (not Stream1[price>10] for 1 sec or not Stream2[price>20] for 1 sec) -> " + + "from every (not Stream1[price>10] for 2 sec or not Stream2[price>20] for 2 sec) -> " + "e3=Stream3[price>30] " + "select e3.symbol as symbol " + "insert into OutputStream ;"; @@ -1977,7 +1977,7 @@ public void testQueryAbsent48() throws InterruptedException { InputHandler stream3 = siddhiAppRuntime.getInputHandler("Stream3"); siddhiAppRuntime.start(); - Thread.sleep(2100); + Thread.sleep(4200); stream3.send(new Object[]{"WSO2", 35.0f, 100}); Thread.sleep(1000); From ac0c1cd12df823cf3d896012f494fbe59b1fe79c Mon Sep 17 00:00:00 2001 From: Mohan Date: Tue, 10 Sep 2019 17:15:15 +0530 Subject: [PATCH 3/3] Reduce the probability of test failure --- .../query/pattern/absent/LogicalAbsentPatternTestCase.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/siddhi-core/src/test/java/io/siddhi/core/query/pattern/absent/LogicalAbsentPatternTestCase.java b/modules/siddhi-core/src/test/java/io/siddhi/core/query/pattern/absent/LogicalAbsentPatternTestCase.java index 04359f665d..d3b5adfbd3 100644 --- a/modules/siddhi-core/src/test/java/io/siddhi/core/query/pattern/absent/LogicalAbsentPatternTestCase.java +++ b/modules/siddhi-core/src/test/java/io/siddhi/core/query/pattern/absent/LogicalAbsentPatternTestCase.java @@ -1952,7 +1952,7 @@ public void testQueryAbsent47() throws InterruptedException { siddhiAppRuntime.shutdown(); } - @Test //(dependsOnMethods = {"testQueryAbsent47"}) + @Test(dependsOnMethods = {"testQueryAbsent47"}) public void testQueryAbsent48() throws InterruptedException { log.info("Test the query every (not e1 for 2 sec or not e2 for 2 sec) -> e3 with only e3 after 4 seconds"); @@ -1977,7 +1977,7 @@ public void testQueryAbsent48() throws InterruptedException { InputHandler stream3 = siddhiAppRuntime.getInputHandler("Stream3"); siddhiAppRuntime.start(); - Thread.sleep(4200); + Thread.sleep(4100); stream3.send(new Object[]{"WSO2", 35.0f, 100}); Thread.sleep(1000);