Permalink
Browse files

Improve the test execution for multipart-mime tests. Server is

started/shutdown once per class instead of per test.
This brings the build time for pegasus down from 20+ minutes to 6.5 mins.

RB=1098968
R=dhoa,aponniah,xma,mnchen
A=xma
  • Loading branch information...
karthikbalasub committed Sep 12, 2017
1 parent a3d3767 commit 4727cb78dade983da91dad11281db5439acc6809
View
@@ -1,6 +1,7 @@
15.0.2
-------
(RB=1098968)
Improve the test execution for multipart-mime tests. Server is started/shutdown once per class instead of per test. This brings the build time for pegasus down from 20+ minutes to 6.5 mins.
15.0.1
-------
@@ -35,8 +35,8 @@
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicInteger;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
/**
@@ -52,7 +52,7 @@
protected TransportClientFactory _clientFactory;
protected Client _client;
@BeforeMethod
@BeforeClass
public void setup() throws IOException
{
_clientFactory = getClientFactory();
@@ -61,7 +61,7 @@ public void setup() throws IOException
_server.start();
}
@AfterMethod
@AfterClass
public void tearDown() throws Exception
{
final FutureCallback<None> clientShutdownCallback = new FutureCallback<None>();
@@ -64,7 +64,6 @@
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
@@ -98,21 +97,9 @@
private ScheduledExecutorService _scheduledExecutorService;
@BeforeClass
public void threadPoolSetup()
{
_scheduledExecutorService = Executors.newScheduledThreadPool(30);
}
@AfterClass
public void threadPoolTearDown()
{
_scheduledExecutorService.shutdownNow();
}
@BeforeMethod
public void setup() throws IOException
{
_latch = new CountDownLatch(2);
_scheduledExecutorService = Executors.newScheduledThreadPool(30);
_clientFactory = new HttpClientFactory();
_client = new TransportClientAdapter(_clientFactory.getClient(Collections.<String, String>emptyMap()));
_server_A_client = new TransportClientAdapter(_clientFactory.getClient(Collections.<String, String>emptyMap()));
@@ -133,9 +120,10 @@ public void setup() throws IOException
_serverB.start();
}
@AfterMethod
@AfterClass
public void tearDown() throws Exception
{
_scheduledExecutorService.shutdownNow();
final FutureCallback<None> clientShutdownCallback = new FutureCallback<None>();
_client.shutdown(clientShutdownCallback);
clientShutdownCallback.get();
@@ -154,6 +142,12 @@ public void tearDown() throws Exception
_serverB.waitForStop();
}
@BeforeMethod
public void setupMethod() throws IOException
{
_latch = new CountDownLatch(2);
}
@DataProvider(name = "chunkSizes")
public Object[][] chunkSizes() throws Exception
{
@@ -60,8 +60,8 @@
import java.util.concurrent.atomic.AtomicInteger;
import org.testng.Assert;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@@ -91,7 +91,7 @@
MIMEDataPart _bodyLessBody;
MIMEDataPart _purelyEmptyBody;
@BeforeSuite
@BeforeClass
public void dataSourceSetup()
{
scheduledExecutorService = Executors.newScheduledThreadPool(10);
@@ -118,7 +118,7 @@ public void dataSourceSetup()
_purelyEmptyBody = new MIMEDataPart(ByteString.empty(), Collections.<String, String>emptyMap());
}
@AfterSuite
@AfterClass
public void shutDown()
{
scheduledExecutorService.shutdownNow();

0 comments on commit 4727cb7

Please sign in to comment.