Longer wait time for threading test (5 min now) and an assertion to ensure that all jobs finished. Should probably just remove the longer running test so this becoming a non-issue
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@4999 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
afbea9ce59
commit
af1bce3492
|
|
@ -212,6 +212,11 @@ public class GenomeLocProcessingTrackerUnitTest extends BaseTest {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final <T> void assertAllThreadsFinished(List<Future<T>> futures) {
|
||||||
|
for ( Future f : futures )
|
||||||
|
Assert.assertTrue(f.isDone(), "Thread never finished running");
|
||||||
|
}
|
||||||
|
|
||||||
@Test(dataProvider = "data", enabled = true)
|
@Test(dataProvider = "data", enabled = true)
|
||||||
public void testThreadedProcesses(TestTarget test) {
|
public void testThreadedProcesses(TestTarget test) {
|
||||||
// start up 3 threads
|
// start up 3 threads
|
||||||
|
|
@ -224,15 +229,17 @@ public class GenomeLocProcessingTrackerUnitTest extends BaseTest {
|
||||||
ExecutorService exec = java.util.concurrent.Executors.newFixedThreadPool(threads.size());
|
ExecutorService exec = java.util.concurrent.Executors.newFixedThreadPool(threads.size());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
List<Future<Integer>> results = exec.invokeAll(threads, 60, TimeUnit.SECONDS);
|
List<Future<Integer>> results = exec.invokeAll(threads, 300, TimeUnit.SECONDS);
|
||||||
GenomeLocProcessingTracker tracker = test.getTracker();
|
GenomeLocProcessingTracker tracker = test.getTracker();
|
||||||
List<GenomeLoc> shards = test.getShards();
|
List<GenomeLoc> shards = test.getShards();
|
||||||
|
|
||||||
for ( TestThread thread : threads )
|
for ( TestThread thread : threads )
|
||||||
logger.warn(String.format("TestThread ran %d jobs", thread.ran.size()));
|
logger.warn(String.format("TestThread ran %d jobs", thread.ran.size()));
|
||||||
|
|
||||||
|
assertAllThreadsFinished(results);
|
||||||
|
|
||||||
// we ran everything
|
// we ran everything
|
||||||
Assert.assertEquals(tracker.getProcessingLocs().size(), shards.size());
|
Assert.assertEquals(tracker.getProcessingLocs().size(), shards.size(), "Not all shards were run");
|
||||||
|
|
||||||
for ( GenomeLoc shard : shards ) {
|
for ( GenomeLoc shard : shards ) {
|
||||||
Assert.assertTrue(tracker.locIsOwned(shard), "Unowned shard");
|
Assert.assertTrue(tracker.locIsOwned(shard), "Unowned shard");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue