This is an automated email from the ASF dual-hosted git repository. rombert pushed a commit to annotated tag org.apache.sling.discovery.base-1.1.4 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-discovery-base.git
commit 42465788cb5c36675b3392e8728ea592c215af79 Author: Stefan Egli <[email protected]> AuthorDate: Wed Apr 27 09:25:49 2016 +0000 SLING-5598 : exclude slow running test by newly introduced Slow junit category - to run them nevertheless use -PincludeSlowTests git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/discovery/base@1741177 13f79535-47bb-0310-9956-ffa450edef68 --- pom.xml | 40 +++++++++++++----- .../announcement/AnnouncementRegistryImplTest.java | 47 +++++++++++++++++----- .../base/its/AbstractClusterLoadTest.java | 19 +++++++++ .../discovery/base/its/AbstractClusterTest.java | 6 +++ .../base/its/AbstractDiscoveryServiceTest.java | 21 ++++++++++ 5 files changed, 113 insertions(+), 20 deletions(-) diff --git a/pom.xml b/pom.xml index be03e96..497656f 100644 --- a/pom.xml +++ b/pom.xml @@ -40,15 +40,21 @@ <url>http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/discovery/base</url> </scm> + <properties> + <!-- by default Slow tests are excluded - use -PincludeSlowTests to include them --> + <sling.excluded.surefire.groups>org.apache.sling.commons.testing.junit.categories.Slow</sling.excluded.surefire.groups> + </properties> + <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> - <configuration> - <redirectTestOutputToFile>false</redirectTestOutputToFile> - <argLine>-Xmx2048m</argLine> - </configuration> + <configuration> + <redirectTestOutputToFile>true</redirectTestOutputToFile> + <argLine>-Xmx2048m</argLine> + <excludedGroups>${sling.excluded.surefire.groups}</excludedGroups> + </configuration> </plugin> <plugin> <groupId>org.apache.felix</groupId> @@ -90,6 +96,17 @@ </plugin> </plugins> </build> + <profiles> + <profile> + <!-- when -PincludeSlowTests is set, the Slow tests should also be executed, + hence unsetting the category excludes 'sling.excluded.surefire.groups' to + achieve that. --> + <id>includeSlowTests</id> + <properties> + <sling.excluded.surefire.groups></sling.excluded.surefire.groups> + </properties> + </profile> + </profiles> <dependencies> <dependency> <groupId>org.apache.felix</groupId> @@ -127,7 +144,7 @@ <dependency> <groupId>org.apache.jackrabbit</groupId> <artifactId>jackrabbit-api</artifactId> - <version>2.2.4</version> + <version>2.10.2</version> <scope>provided</scope> </dependency> <dependency> @@ -151,7 +168,7 @@ <dependency> <groupId>org.apache.sling</groupId> <artifactId>org.apache.sling.discovery.commons</artifactId> - <version>1.0.7-SNAPSHOT</version> + <version>1.0.13-SNAPSHOT</version> </dependency> <!-- besides including discovery.commons' normal jar above, for testing a few test helper classes are also reused. @@ -159,7 +176,7 @@ <dependency> <groupId>org.apache.sling</groupId> <artifactId>org.apache.sling.discovery.commons</artifactId> - <version>1.0.7-SNAPSHOT</version> + <version>1.0.13-SNAPSHOT</version> <scope>test</scope> <type>test-jar</type> </dependency> @@ -229,6 +246,10 @@ <dependency> <groupId>org.jmock</groupId> <artifactId>jmock-junit4</artifactId> + <!-- with 2.5.1 jmock-junit4, which has a dependency on junit 4.4 + you get the following: NoSuchMethodError: org.junit.runner.Request.classes(Lorg/junit/runner/Computer;[Ljava/lang/Class;)Lorg/junit/runner/Request; + hence this explicit newer dependency. --> + <!-- <version>2.8.2</version> --> </dependency> <dependency> <groupId>org.mockito</groupId> @@ -239,13 +260,13 @@ <dependency> <groupId>org.apache.jackrabbit</groupId> <artifactId>jackrabbit-jcr-commons</artifactId> - <version>2.10.1</version> + <version>2.12.1</version> <scope>test</scope> </dependency> <dependency> <groupId>org.apache.sling</groupId> <artifactId>org.apache.sling.commons.testing</artifactId> - <version>2.0.22</version> + <version>2.0.25-SNAPSHOT</version> <scope>test</scope> <exclusions> <!-- slf4j simple implementation logs INFO + higher to stdout (we don't want that behaviour) --> @@ -296,6 +317,7 @@ <groupId>org.apache.sling</groupId> <artifactId>org.apache.sling.testing.sling-mock</artifactId> <version>1.2.0</version> + <scope>test</scope> </dependency> </dependencies> </project> diff --git a/src/test/java/org/apache/sling/discovery/base/connectors/announcement/AnnouncementRegistryImplTest.java b/src/test/java/org/apache/sling/discovery/base/connectors/announcement/AnnouncementRegistryImplTest.java index 062a56b..3706d6e 100644 --- a/src/test/java/org/apache/sling/discovery/base/connectors/announcement/AnnouncementRegistryImplTest.java +++ b/src/test/java/org/apache/sling/discovery/base/connectors/announcement/AnnouncementRegistryImplTest.java @@ -31,6 +31,7 @@ import javax.jcr.Session; import org.apache.sling.api.resource.ResourceResolverFactory; import org.apache.sling.commons.testing.jcr.RepositoryProvider; +import org.apache.sling.commons.testing.junit.categories.Slow; import org.apache.sling.discovery.ClusterView; import org.apache.sling.discovery.InstanceDescription; import org.apache.sling.discovery.base.connectors.BaseConfig; @@ -43,6 +44,7 @@ import org.apache.sling.discovery.commons.providers.DefaultInstanceDescription; import org.apache.sling.discovery.commons.providers.spi.base.DummySlingSettingsService; import org.junit.Before; import org.junit.Test; +import org.junit.experimental.categories.Category; public class AnnouncementRegistryImplTest { @@ -78,6 +80,16 @@ public class AnnouncementRegistryImplTest { @Test public void testRegisterUnregister() throws Exception { + doTestRegisterUnregister(false); + } + + @Category(Slow.class) + @Test + public void testRegisterUnregister_Slow() throws Exception { + doTestRegisterUnregister(true); + } + + private void doTestRegisterUnregister(boolean includeFinalExpiryCheck) throws Exception { try{ registry.registerAnnouncement(null); fail("should complain"); @@ -142,9 +154,10 @@ public class AnnouncementRegistryImplTest { assertTrue(registry.registerAnnouncement(ann)!=-1); assertEquals(1, registry.listInstances(localCluster).size()); - Thread.sleep(10500); - assertEquals(0, registry.listInstances(localCluster).size()); - + if (includeFinalExpiryCheck) { + Thread.sleep(10500); + assertEquals(0, registry.listInstances(localCluster).size()); + } } @Test @@ -315,6 +328,16 @@ public class AnnouncementRegistryImplTest { @Test public void testCluster() throws Exception { + doTestCluster(false); + } + + @Category(Slow.class) + @Test + public void testCluster_Slow() throws Exception { + doTestCluster(true); + } + + private void doTestCluster(boolean includeFinalExpiryCheck) throws Exception { ClusterView cluster1 = createCluster(2); ClusterView cluster2 = createCluster(4); ClusterView cluster3 = createCluster(7); @@ -372,15 +395,17 @@ public class AnnouncementRegistryImplTest { assertEquals(0, registry2.listLocalIncomingAnnouncements().size()); assertAnnouncements(registry2, myCluster, 3, 8); - Thread.sleep(10500); - assertAnnouncements(registry1, myCluster, 3, 8); - assertAnnouncements(registry2, myCluster, 3, 8); - registry1.checkExpiredAnnouncements(); - registry2.checkExpiredAnnouncements(); - assertAnnouncements(registry1, myCluster, 1, 2); - assertAnnouncements(registry2, myCluster, 1, 2); + if (includeFinalExpiryCheck) { + Thread.sleep(10500); + assertAnnouncements(registry1, myCluster, 3, 8); + assertAnnouncements(registry2, myCluster, 3, 8); + registry1.checkExpiredAnnouncements(); + registry2.checkExpiredAnnouncements(); + assertAnnouncements(registry1, myCluster, 1, 2); + assertAnnouncements(registry2, myCluster, 1, 2); + } } - + private void assertAnnouncements(AnnouncementRegistryImpl registry, ClusterView myCluster, int expectedNumAnnouncements, int expectedNumInstances) { Announcement ann = createAnnouncement(myCluster, 0, false); diff --git a/src/test/java/org/apache/sling/discovery/base/its/AbstractClusterLoadTest.java b/src/test/java/org/apache/sling/discovery/base/its/AbstractClusterLoadTest.java index 7667335..ae98d3d 100644 --- a/src/test/java/org/apache/sling/discovery/base/its/AbstractClusterLoadTest.java +++ b/src/test/java/org/apache/sling/discovery/base/its/AbstractClusterLoadTest.java @@ -25,6 +25,7 @@ import java.util.LinkedList; import java.util.List; import java.util.Random; +import org.apache.sling.commons.testing.junit.categories.Slow; import org.apache.sling.discovery.base.commons.UndefinedClusterViewException; import org.apache.sling.discovery.base.its.setup.VirtualInstance; import org.apache.sling.discovery.base.its.setup.VirtualInstanceBuilder; @@ -32,6 +33,7 @@ import org.apache.sling.discovery.base.its.setup.WithholdingAppender; import org.apache.sling.testing.tools.retry.RetryLoop; import org.junit.After; import org.junit.Test; +import org.junit.experimental.categories.Category; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -110,35 +112,52 @@ public abstract class AbstractClusterLoadTest { } @Test + public void testTwoInstancesFast() throws Throwable { + doTest(2, 3); + } + + @Test + public void testThreeInstancesFast() throws Throwable { + doTest(3, 3); + } + + @Category(Slow.class) + @Test public void testTwoInstances() throws Throwable { doTest(2, 5); } + @Category(Slow.class) @Test public void testThreeInstances() throws Throwable { doTest(3, 6); } + @Category(Slow.class) @Test public void testFourInstances() throws Throwable { doTest(4, 7); } + @Category(Slow.class) @Test public void testFiveInstances() throws Throwable { doTest(5, 8); } + @Category(Slow.class) @Test public void testSixInstances() throws Throwable { doTest(6, 9); } + @Category(Slow.class) @Test public void testSevenInstances() throws Throwable { doTest(7, 10); } + @Category(Slow.class) @Test public void testEightInstances() throws Throwable { doTest(8, 50); diff --git a/src/test/java/org/apache/sling/discovery/base/its/AbstractClusterTest.java b/src/test/java/org/apache/sling/discovery/base/its/AbstractClusterTest.java index 6b25821..80ff0c0 100644 --- a/src/test/java/org/apache/sling/discovery/base/its/AbstractClusterTest.java +++ b/src/test/java/org/apache/sling/discovery/base/its/AbstractClusterTest.java @@ -36,6 +36,7 @@ import java.util.concurrent.Semaphore; import org.apache.log4j.Level; import org.apache.log4j.LogManager; +import org.apache.sling.commons.testing.junit.categories.Slow; import org.apache.sling.discovery.ClusterView; import org.apache.sling.discovery.InstanceDescription; import org.apache.sling.discovery.TopologyEvent; @@ -56,6 +57,7 @@ import org.apache.sling.discovery.base.its.setup.mock.PropertyProviderImpl; import org.junit.After; import org.junit.Before; import org.junit.Test; +import org.junit.experimental.categories.Category; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -325,6 +327,7 @@ public abstract class AbstractClusterTest { * then simulate load balancer switching from instance1 to instance2 - hence pings go to instance2 * */ + @Category(Slow.class) //TODO: this takes env 45sec @Test public void testConnectorSwitching4139() throws Throwable { final int MIN_EVENT_DELAY = 1; @@ -504,6 +507,7 @@ public abstract class AbstractClusterTest { } + @Category(Slow.class) //TODO: this takes env 25sec @Test public void testDuplicateInstance3726() throws Throwable { logger.info("testDuplicateInstance3726: start"); @@ -1240,6 +1244,7 @@ public abstract class AbstractClusterTest { logger.info("testClusterView: end"); } + @Category(Slow.class) //TODO: this takes env 15sec @Test public void testAdditionalInstance() throws Throwable { logger.info("testAdditionalInstance: start"); @@ -1454,6 +1459,7 @@ public abstract class AbstractClusterTest { * the second listener still gets the event * @throws Throwable */ + @Category(Slow.class) //TODO: this takes env 15sec @Test public void testLongRunningListener() throws Throwable { // let the instance1 become alone, instance2 is idle diff --git a/src/test/java/org/apache/sling/discovery/base/its/AbstractDiscoveryServiceTest.java b/src/test/java/org/apache/sling/discovery/base/its/AbstractDiscoveryServiceTest.java index 3d86138..2e69c7d 100644 --- a/src/test/java/org/apache/sling/discovery/base/its/AbstractDiscoveryServiceTest.java +++ b/src/test/java/org/apache/sling/discovery/base/its/AbstractDiscoveryServiceTest.java @@ -27,6 +27,7 @@ import java.util.LinkedList; import java.util.List; import java.util.Random; +import org.apache.sling.commons.testing.junit.categories.Slow; import org.apache.sling.discovery.InstanceDescription; import org.apache.sling.discovery.TopologyEvent; import org.apache.sling.discovery.TopologyEvent.Type; @@ -39,6 +40,7 @@ import org.apache.sling.testing.tools.retry.RetryLoop.Condition; import org.junit.After; import org.junit.Before; import org.junit.Test; +import org.junit.experimental.categories.Category; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -277,6 +279,22 @@ public abstract class AbstractDiscoveryServiceTest { } @Test + public void testFiveInstances() throws Throwable { + logger.info("testFiveInstances: start"); + Tester i1 = newInstance("i1", 1, 30, 250, null); + for(int i=2; i<=5; i++) { + Tester in = newInstance("i"+i, 1, 30, 250, i1.instance); + } + logger.info("testFiveInstances: starting retry loop (40sec max)"); + startRetryLoop(testers, 40); + i1.instance.dumpRepo(); + i1.assertNoFailures(); + assertStableTopology(testers.toArray(new Tester[0])); + logger.info("testFiveInstances: end"); + } + + @Category(Slow.class) //TODO: this takes env 10sec + @Test public void testTenInstances() throws Throwable { logger.info("testTenInstances: start"); Tester i1 = newInstance("i1", 1, 30, 250, null); @@ -291,6 +309,7 @@ public abstract class AbstractDiscoveryServiceTest { logger.info("testTenInstances: end"); } + @Category(Slow.class) //TODO: this takes env 15sec @Test public void testTwentyInstances() throws Throwable { logger.info("testTwentyInstances: start"); @@ -306,6 +325,7 @@ public abstract class AbstractDiscoveryServiceTest { logger.info("testTwentyInstances: end"); } + @Category(Slow.class) //TODO: this takes env 40sec @Test public void testTwentyFourInstances() throws Throwable { logger.info("testTwentyFourInstances: start"); @@ -350,6 +370,7 @@ public abstract class AbstractDiscoveryServiceTest { }, retryTimeoutSeconds /*seconds*/, 1000/*millis*/); } + @Category(Slow.class) //TODO: this takes env 120sec @Test public void testStartStopFiesta() throws Throwable { final Tester[] instances = new Tester[8]; -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
