You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@twill.apache.org by ch...@apache.org on 2014/07/29 09:33:59 UTC
[2/2] git commit: Increase test timeout and alter Travis setting to
show test output
Increase test timeout and alter Travis setting to show test output
Project: http://git-wip-us.apache.org/repos/asf/incubator-twill/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-twill/commit/8a230034
Tree: http://git-wip-us.apache.org/repos/asf/incubator-twill/tree/8a230034
Diff: http://git-wip-us.apache.org/repos/asf/incubator-twill/diff/8a230034
Branch: refs/heads/master
Commit: 8a2300345004a08df0e80bf92eba875700aa61aa
Parents: 7f12d16
Author: Terence Yim <te...@continuuity.com>
Authored: Mon Jul 28 18:04:00 2014 -0700
Committer: Terence Yim <ch...@apache.org>
Committed: Tue Jul 29 00:33:21 2014 -0700
----------------------------------------------------------------------
.travis.yml | 2 +-
pom.xml | 2 ++
.../apache/twill/yarn/LogHandlerTestRun.java | 18 +++++++++++----
.../twill/yarn/ResourceReportTestRun.java | 24 ++++++++++----------
.../internal/zookeeper/LeaderElectionTest.java | 22 +++++++++---------
5 files changed, 39 insertions(+), 29 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-twill/blob/8a230034/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index c6bdfce..2468cd7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -27,7 +27,7 @@ branches:
- /^branch\-.*$/
- /^feature\/.*$/
-script: mvn test -P $PROFILE
+script: mvn test -P $PROFILE -Dsurefire.redirectTestOutputToFile=false
install: mvn install -P $PROFILE -DskipTests=true
http://git-wip-us.apache.org/repos/asf/incubator-twill/blob/8a230034/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 6ba1900..98f531e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -344,6 +344,8 @@
<systemPropertyVariables>
<java.io.tmpdir>${project.build.directory}</java.io.tmpdir>
</systemPropertyVariables>
+ <reuseForks>false</reuseForks>
+ <reportFormat>plain</reportFormat>
<includes>
<include>**/*TestSuite.java</include>
<include>**/Test*.java</include>
http://git-wip-us.apache.org/repos/asf/incubator-twill/blob/8a230034/twill-yarn/src/test/java/org/apache/twill/yarn/LogHandlerTestRun.java
----------------------------------------------------------------------
diff --git a/twill-yarn/src/test/java/org/apache/twill/yarn/LogHandlerTestRun.java b/twill-yarn/src/test/java/org/apache/twill/yarn/LogHandlerTestRun.java
index f5ead6b..7e6d78c 100644
--- a/twill-yarn/src/test/java/org/apache/twill/yarn/LogHandlerTestRun.java
+++ b/twill-yarn/src/test/java/org/apache/twill/yarn/LogHandlerTestRun.java
@@ -24,7 +24,6 @@ import org.apache.twill.api.logging.LogEntry;
import org.apache.twill.api.logging.LogHandler;
import org.apache.twill.api.logging.LogThrowable;
import org.apache.twill.api.logging.PrinterLogHandler;
-import org.apache.twill.common.Services;
import org.junit.Assert;
import org.junit.Test;
import org.slf4j.Logger;
@@ -68,8 +67,11 @@ public class LogHandlerTestRun extends BaseYarnTest {
.addLogHandler(logHandler)
.start();
- Services.getCompletionFuture(controller).get();
- latch.await(1, TimeUnit.SECONDS);
+ try {
+ Assert.assertTrue(latch.await(100, TimeUnit.SECONDS));
+ } finally {
+ controller.stopAndWait();
+ }
// Verify the log throwable
Assert.assertEquals(1, throwables.size());
@@ -90,7 +92,7 @@ public class LogHandlerTestRun extends BaseYarnTest {
public static final class LogRunnable extends AbstractTwillRunnable {
private static final Logger LOG = LoggerFactory.getLogger(LogRunnable.class);
-
+ private final CountDownLatch stopLatch = new CountDownLatch(1);
@Override
public void run() {
@@ -105,11 +107,17 @@ public class LogHandlerTestRun extends BaseYarnTest {
} catch (Throwable t) {
LOG.error("Got exception", t);
}
+
+ try {
+ stopLatch.await();
+ } catch (InterruptedException e) {
+ LOG.error("Interrupted", e);
+ }
}
@Override
public void stop() {
-
+ stopLatch.countDown();
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-twill/blob/8a230034/twill-yarn/src/test/java/org/apache/twill/yarn/ResourceReportTestRun.java
----------------------------------------------------------------------
diff --git a/twill-yarn/src/test/java/org/apache/twill/yarn/ResourceReportTestRun.java b/twill-yarn/src/test/java/org/apache/twill/yarn/ResourceReportTestRun.java
index 71bb607..b800f02 100644
--- a/twill-yarn/src/test/java/org/apache/twill/yarn/ResourceReportTestRun.java
+++ b/twill-yarn/src/test/java/org/apache/twill/yarn/ResourceReportTestRun.java
@@ -66,11 +66,11 @@ public final class ResourceReportTestRun extends BaseYarnTest {
.withRunnable()
.add("echo1", new EchoServer(), ResourceSpecification.Builder.with()
.setVirtualCores(1)
- .setMemory(128, ResourceSpecification.SizeUnit.MEGA)
+ .setMemory(256, ResourceSpecification.SizeUnit.MEGA)
.setInstances(2).build()).noLocalFiles()
.add("echo2", new EchoServer(), ResourceSpecification.Builder.with()
.setVirtualCores(2)
- .setMemory(256, ResourceSpecification.SizeUnit.MEGA)
+ .setMemory(512, ResourceSpecification.SizeUnit.MEGA)
.setInstances(1).build()).noLocalFiles()
.anyOrder()
.build();
@@ -138,7 +138,7 @@ public final class ResourceReportTestRun extends BaseYarnTest {
ResourceSpecification resourceSpec = ResourceSpecification.Builder.with()
.setVirtualCores(1)
- .setMemory(128, ResourceSpecification.SizeUnit.MEGA)
+ .setMemory(256, ResourceSpecification.SizeUnit.MEGA)
.setInstances(2)
.build();
TwillController controller = runner.prepare(new BuggyServer(), resourceSpec)
@@ -155,10 +155,10 @@ public final class ResourceReportTestRun extends BaseYarnTest {
}
}, Threads.SAME_THREAD_EXECUTOR);
- Assert.assertTrue(running.await(30, TimeUnit.SECONDS));
+ Assert.assertTrue(running.await(120, TimeUnit.SECONDS));
Iterable<Discoverable> echoServices = controller.discoverService("echo");
- Assert.assertTrue(YarnTestUtils.waitForSize(echoServices, 2, 60));
+ Assert.assertTrue(YarnTestUtils.waitForSize(echoServices, 2, 120));
// check that we have 2 runnables.
ResourceReport report = controller.getResourceReport();
Assert.assertEquals(2, report.getRunnableResources("BuggyServer").size());
@@ -176,7 +176,7 @@ public final class ResourceReportTestRun extends BaseYarnTest {
// takes some time for app master to find out the container completed...
int count = 0;
- while (count < 20) {
+ while (count < 100) {
report = controller.getResourceReport();
// check that we have 1 runnable, not 2.
if (report.getRunnableResources("BuggyServer").size() == 1) {
@@ -188,7 +188,7 @@ public final class ResourceReportTestRun extends BaseYarnTest {
}
Assert.assertTrue("Still has 2 contains running after 20 seconds", count < 20);
- controller.stop().get(30, TimeUnit.SECONDS);
+ controller.stop().get(100, TimeUnit.SECONDS);
// Sleep a bit before exiting.
TimeUnit.SECONDS.sleep(2);
}
@@ -217,7 +217,7 @@ public final class ResourceReportTestRun extends BaseYarnTest {
// wait for 3 echo servers to come up
Iterable<Discoverable> echoServices = controller.discoverService("echo");
- Assert.assertTrue(YarnTestUtils.waitForSize(echoServices, 3, 60));
+ Assert.assertTrue(YarnTestUtils.waitForSize(echoServices, 3, 120));
ResourceReport report = controller.getResourceReport();
// make sure resources for echo1 and echo2 are there
Map<String, Collection<TwillRunResources>> usedResources = report.getResources();
@@ -230,7 +230,7 @@ public final class ResourceReportTestRun extends BaseYarnTest {
Assert.assertEquals(2, echo1Resources.size());
// TODO: check cores after hadoop-2.1.0
for (TwillRunResources resources : echo1Resources) {
- Assert.assertEquals(128, resources.getMemoryMB());
+ Assert.assertEquals(256, resources.getMemoryMB());
}
Collection<TwillRunResources> echo2Resources = usedResources.get("echo2");
@@ -238,7 +238,7 @@ public final class ResourceReportTestRun extends BaseYarnTest {
Assert.assertEquals(1, echo2Resources.size());
// TODO: check cores after hadoop-2.1.0
for (TwillRunResources resources : echo2Resources) {
- Assert.assertEquals(256, resources.getMemoryMB());
+ Assert.assertEquals(512, resources.getMemoryMB());
}
// Decrease number of instances of echo1 from 2 to 1
@@ -258,7 +258,7 @@ public final class ResourceReportTestRun extends BaseYarnTest {
Assert.assertEquals(1, echo1Resources.size());
// TODO: check cores after hadoop-2.1.0
for (TwillRunResources resources : echo1Resources) {
- Assert.assertEquals(128, resources.getMemoryMB());
+ Assert.assertEquals(256, resources.getMemoryMB());
}
echo2Resources = usedResources.get("echo2");
@@ -266,7 +266,7 @@ public final class ResourceReportTestRun extends BaseYarnTest {
Assert.assertEquals(1, echo2Resources.size());
// TODO: check cores after hadoop-2.1.0
for (TwillRunResources resources : echo2Resources) {
- Assert.assertEquals(256, resources.getMemoryMB());
+ Assert.assertEquals(512, resources.getMemoryMB());
}
controller.stop().get(30, TimeUnit.SECONDS);
http://git-wip-us.apache.org/repos/asf/incubator-twill/blob/8a230034/twill-zookeeper/src/test/java/org/apache/twill/internal/zookeeper/LeaderElectionTest.java
----------------------------------------------------------------------
diff --git a/twill-zookeeper/src/test/java/org/apache/twill/internal/zookeeper/LeaderElectionTest.java b/twill-zookeeper/src/test/java/org/apache/twill/internal/zookeeper/LeaderElectionTest.java
index 29c0343..d58c11c 100644
--- a/twill-zookeeper/src/test/java/org/apache/twill/internal/zookeeper/LeaderElectionTest.java
+++ b/twill-zookeeper/src/test/java/org/apache/twill/internal/zookeeper/LeaderElectionTest.java
@@ -56,7 +56,7 @@ public class LeaderElectionTest {
private static InMemoryZKServer zkServer;
- @Test(timeout = 30000)
+ @Test(timeout = 100000)
public void testElection() throws ExecutionException, InterruptedException, BrokenBarrierException {
ExecutorService executor = Executors.newCachedThreadPool();
@@ -129,7 +129,7 @@ public class LeaderElectionTest {
}
}
- @Test(timeout = 30000)
+ @Test(timeout = 100000)
public void testCancel() throws InterruptedException, IOException {
List<LeaderElection> leaderElections = Lists.newArrayList();
List<ZKClientService> zkClients = Lists.newArrayList();
@@ -173,13 +173,13 @@ public class LeaderElectionTest {
// Kill the follower session
KillZKSession.kill(zkClients.get(follower).getZooKeeperSupplier().get(),
- zkClients.get(follower).getConnectString(), 10000);
+ zkClients.get(follower).getConnectString(), 20000);
// Cancel the leader
leaderElections.get(leader).stopAndWait();
// Now follower should still be able to become leader.
- leaderSem.tryAcquire(10, TimeUnit.SECONDS);
+ leaderSem.tryAcquire(30, TimeUnit.SECONDS);
leader = leaderIdx.get();
follower = 1 - leader;
@@ -205,7 +205,7 @@ public class LeaderElectionTest {
leaderElections.get(leader).stopAndWait();
// Since the follower has been cancelled before leader, there should be no leader.
- Assert.assertFalse(leaderSem.tryAcquire(2, TimeUnit.SECONDS));
+ Assert.assertFalse(leaderSem.tryAcquire(10, TimeUnit.SECONDS));
} finally {
for (ZKClientService zkClient : zkClients) {
zkClient.stopAndWait();
@@ -213,7 +213,7 @@ public class LeaderElectionTest {
}
}
- @Test(timeout = 30000)
+ @Test(timeout = 100000)
public void testDisconnect() throws IOException, InterruptedException {
File zkDataDir = tmpFolder.newFolder();
InMemoryZKServer ownZKServer = InMemoryZKServer.builder().setDataDir(zkDataDir).build();
@@ -239,7 +239,7 @@ public class LeaderElectionTest {
});
leaderElection.start();
- leaderSem.tryAcquire(10, TimeUnit.SECONDS);
+ leaderSem.tryAcquire(20, TimeUnit.SECONDS);
int zkPort = ownZKServer.getLocalAddress().getPort();
@@ -247,19 +247,19 @@ public class LeaderElectionTest {
ownZKServer.stopAndWait();
// Right after disconnect, it should become follower
- followerSem.tryAcquire(10, TimeUnit.SECONDS);
+ followerSem.tryAcquire(20, TimeUnit.SECONDS);
ownZKServer = InMemoryZKServer.builder().setDataDir(zkDataDir).setPort(zkPort).build();
ownZKServer.startAndWait();
// Right after reconnect, it should be leader again.
- leaderSem.tryAcquire(10, TimeUnit.SECONDS);
+ leaderSem.tryAcquire(20, TimeUnit.SECONDS);
// Now disconnect it again, but then cancel it before reconnect, it shouldn't become leader
ownZKServer.stopAndWait();
// Right after disconnect, it should become follower
- followerSem.tryAcquire(10, TimeUnit.SECONDS);
+ followerSem.tryAcquire(20, TimeUnit.SECONDS);
ListenableFuture<?> cancelFuture = leaderElection.stop();
@@ -269,7 +269,7 @@ public class LeaderElectionTest {
Futures.getUnchecked(cancelFuture);
// After reconnect, it should not be leader
- Assert.assertFalse(leaderSem.tryAcquire(2, TimeUnit.SECONDS));
+ Assert.assertFalse(leaderSem.tryAcquire(10, TimeUnit.SECONDS));
} finally {
zkClient.stopAndWait();
}