From 31827022db588f372f12fd4d9cbc9b3e3a6cfa64 Mon Sep 17 00:00:00 2001 From: David Roazen Date: Fri, 28 Jun 2013 14:57:16 -0400 Subject: [PATCH] Fix pipeline tests that were not respecting the pipeline test dry run setting There are a few pipeline test classes that do not run Queue, but are classified as pipeline tests because they submit farm jobs. Make these unconventional pipeline tests respect the pipeline test dry run setting. --- .../java/test/org/broadinstitute/sting/BaseTest.java | 2 ++ .../sting/jna/drmaa/v1_0/JnaSessionPipelineTest.java | 11 ++++++++--- .../sting/jna/drmaa/v1_0/LibDrmaaPipelineTest.java | 11 ++++++++--- .../sting/jna/lsf/v7_0_6/LibBatPipelineTest.java | 11 ++++++++--- .../sting/queue/pipeline/PipelineTest.scala | 6 ++---- 5 files changed, 28 insertions(+), 13 deletions(-) diff --git a/public/java/test/org/broadinstitute/sting/BaseTest.java b/public/java/test/org/broadinstitute/sting/BaseTest.java index d6cba26d6..f86a9b513 100644 --- a/public/java/test/org/broadinstitute/sting/BaseTest.java +++ b/public/java/test/org/broadinstitute/sting/BaseTest.java @@ -131,6 +131,8 @@ public abstract class BaseTest { public static final String exampleFASTA = publicTestDir + "exampleFASTA.fasta"; + public static final boolean pipelineTestRunModeIsSet = System.getProperty("pipeline.run").equals("run"); + /** before the class starts up */ static { // setup a basic log configuration diff --git a/public/java/test/org/broadinstitute/sting/jna/drmaa/v1_0/JnaSessionPipelineTest.java b/public/java/test/org/broadinstitute/sting/jna/drmaa/v1_0/JnaSessionPipelineTest.java index d2da0e228..5a6a1b769 100644 --- a/public/java/test/org/broadinstitute/sting/jna/drmaa/v1_0/JnaSessionPipelineTest.java +++ b/public/java/test/org/broadinstitute/sting/jna/drmaa/v1_0/JnaSessionPipelineTest.java @@ -29,6 +29,7 @@ import org.apache.commons.io.FileUtils; import org.broadinstitute.sting.BaseTest; import org.ggf.drmaa.*; import org.testng.Assert; +import org.testng.SkipException; import org.testng.annotations.Test; import java.io.File; @@ -51,19 +52,23 @@ public class JnaSessionPipelineTest extends BaseTest { @Test(dependsOnMethods = { "testDrmaa" }) public void testSubmitEcho() throws Exception { + if ( ! pipelineTestRunModeIsSet ) { + throw new SkipException("Skipping testSubmitEcho because we are in pipeline test dry run mode"); + } + if (implementation.contains("LSF")) { System.err.println(" ***********************************************************"); System.err.println(" *************************************************************"); System.err.println(" **** ****"); - System.err.println(" **** Skipping JnaSessionIntegrationTest.testSubmitEcho() ****"); + System.err.println(" **** Skipping JnaSessionPipelineTest.testSubmitEcho() ****"); System.err.println(" **** Are you using the dotkit .combined_LSF_SGE? ****"); System.err.println(" **** ****"); System.err.println(" *************************************************************"); System.err.println(" ***********************************************************"); - return; + throw new SkipException("Skipping testSubmitEcho because correct DRMAA implementation not found"); } - File outFile = tryCreateNetworkTempFile("JnaSessionIntegrationTest.out"); + File outFile = tryCreateNetworkTempFile("JnaSessionPipelineTest.out"); Session session = factory.getSession(); session.init(null); try { diff --git a/public/java/test/org/broadinstitute/sting/jna/drmaa/v1_0/LibDrmaaPipelineTest.java b/public/java/test/org/broadinstitute/sting/jna/drmaa/v1_0/LibDrmaaPipelineTest.java index efeeb3640..13bad765b 100644 --- a/public/java/test/org/broadinstitute/sting/jna/drmaa/v1_0/LibDrmaaPipelineTest.java +++ b/public/java/test/org/broadinstitute/sting/jna/drmaa/v1_0/LibDrmaaPipelineTest.java @@ -34,6 +34,7 @@ import com.sun.jna.ptr.PointerByReference; import org.apache.commons.io.FileUtils; import org.broadinstitute.sting.BaseTest; import org.testng.Assert; +import org.testng.SkipException; import org.testng.annotations.Test; import java.io.File; @@ -87,22 +88,26 @@ public class LibDrmaaPipelineTest extends BaseTest { @Test(dependsOnMethods = { "testDrmaa" }) public void testSubmitEcho() throws Exception { + if ( ! pipelineTestRunModeIsSet ) { + throw new SkipException("Skipping testSubmitEcho because we are in pipeline test dry run mode"); + } + if (implementation.contains("LSF")) { System.err.println(" *********************************************************"); System.err.println(" ***********************************************************"); System.err.println(" **** ****"); - System.err.println(" **** Skipping LibDrmaaIntegrationTest.testSubmitEcho() ****"); + System.err.println(" **** Skipping LibDrmaaPipelineTest.testSubmitEcho() ****"); System.err.println(" **** Are you using the dotkit .combined_LSF_SGE? ****"); System.err.println(" **** ****"); System.err.println(" ***********************************************************"); System.err.println(" *********************************************************"); - return; + throw new SkipException("Skipping testSubmitEcho because correct DRMAA implementation not found"); } Memory error = new Memory(LibDrmaa.DRMAA_ERROR_STRING_BUFFER); int errnum; - File outFile = tryCreateNetworkTempFile("LibDrmaaIntegrationTest.out"); + File outFile = tryCreateNetworkTempFile("LibDrmaaPipelineTest.out"); errnum = LibDrmaa.drmaa_init(null, error, LibDrmaa.DRMAA_ERROR_STRING_BUFFER_LEN); diff --git a/public/java/test/org/broadinstitute/sting/jna/lsf/v7_0_6/LibBatPipelineTest.java b/public/java/test/org/broadinstitute/sting/jna/lsf/v7_0_6/LibBatPipelineTest.java index af8d0e7b1..4db600fc1 100644 --- a/public/java/test/org/broadinstitute/sting/jna/lsf/v7_0_6/LibBatPipelineTest.java +++ b/public/java/test/org/broadinstitute/sting/jna/lsf/v7_0_6/LibBatPipelineTest.java @@ -30,6 +30,7 @@ import com.sun.jna.ptr.IntByReference; import org.apache.commons.io.FileUtils; import org.broadinstitute.sting.utils.Utils; import org.testng.Assert; +import org.testng.SkipException; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import org.broadinstitute.sting.BaseTest; @@ -43,7 +44,7 @@ import java.io.File; public class LibBatPipelineTest extends BaseTest { @BeforeClass public void initLibBat() { - Assert.assertFalse(LibBat.lsb_init("LibBatIntegrationTest") < 0, LibBat.lsb_sperror("lsb_init() failed")); + Assert.assertFalse(LibBat.lsb_init("LibBatPipelineTest") < 0, LibBat.lsb_sperror("lsb_init() failed")); } @Test @@ -93,15 +94,19 @@ public class LibBatPipelineTest extends BaseTest { @Test public void testSubmitEcho() throws Exception { + if ( ! pipelineTestRunModeIsSet ) { + throw new SkipException("Skipping testSubmitEcho because we are in pipeline test dry run mode"); + } + String queue = "hour"; - File outFile = tryCreateNetworkTempFile("LibBatIntegrationTest.out"); + File outFile = tryCreateNetworkTempFile("LibBatPipelineTest.out"); submit req = new submit(); for (int i = 0; i < LibLsf.LSF_RLIM_NLIMITS; i++) req.rLimits[i] = LibLsf.DEFAULT_RLIMIT; - req.projectName = "LibBatIntegrationTest"; + req.projectName = "LibBatPipelineTest"; req.options |= LibBat.SUB_PROJECT_NAME; req.queue = queue; diff --git a/public/scala/test/org/broadinstitute/sting/queue/pipeline/PipelineTest.scala b/public/scala/test/org/broadinstitute/sting/queue/pipeline/PipelineTest.scala index 6741e4107..e990b5233 100644 --- a/public/scala/test/org/broadinstitute/sting/queue/pipeline/PipelineTest.scala +++ b/public/scala/test/org/broadinstitute/sting/queue/pipeline/PipelineTest.scala @@ -45,8 +45,6 @@ object PipelineTest extends BaseTest with Logging { private val validationReportsDataLocation = "/humgen/gsa-hpprojects/GATK/validationreports/submitted/" private val md5DB = new MD5DB() - final val run = System.getProperty("pipeline.run") == "run" - final val allJobRunners = { val commandLinePluginManager = new CommandLinePluginManager commandLinePluginManager.getPlugins.map(commandLinePluginManager.getName(_)).toSeq @@ -100,7 +98,7 @@ object PipelineTest extends BaseTest with Logging { Assert.fail("PipelineTestSpec.name is null") println(Utils.dupString('-', 80)); executeTest(name, pipelineTest.args, pipelineTest.jobQueue, pipelineTest.expectedException, jobRunner) - if (run) { + if (BaseTest.pipelineTestRunModeIsSet) { assertMatchingMD5s(name, pipelineTest.fileMD5s.map{case (file, md5) => new File(runDir(name, jobRunner), file) -> md5}, pipelineTest.parameterize) if (pipelineTest.evalSpec != null) validateEval(name, pipelineTest.evalSpec, jobRunner) @@ -169,7 +167,7 @@ object PipelineTest extends BaseTest with Logging { if (jobQueue != null) command = Utils.appendArray(command, "-jobQueue", jobQueue) - if (run) + if (BaseTest.pipelineTestRunModeIsSet) command = Utils.appendArray(command, "-run") // run the executable