From 51f1207183b1a195ddd1b51bb85e0860cbcedac6 Mon Sep 17 00:00:00 2001 From: Trey Chadick Date: Fri, 10 May 2024 08:11:28 -0700 Subject: [PATCH] Escape `context.pipelineConfig` property for tests (#291) --- SequenceAnalysis/build.gradle | 11 ++++------- .../SequenceRemoteIntegrationTests.java | 4 ++++ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/SequenceAnalysis/build.gradle b/SequenceAnalysis/build.gradle index 41f773aaf..9fa097daf 100644 --- a/SequenceAnalysis/build.gradle +++ b/SequenceAnalysis/build.gradle @@ -177,7 +177,7 @@ dependencies { if (project.findProject(BuildUtils.getTestProjectPath(project.gradle)) != null && project.hasProperty("teamcity")) { project.evaluationDependsOn(BuildUtils.getTestProjectPath(project.gradle)) - def configDir = "${ServerDeployExtension.getServerDeployDirectory(project)}/config" + def configDir = new File(ServerDeployExtension.getServerDeployDirectory(project), "config") def testProject = project.findProject(BuildUtils.getTestProjectPath(project.gradle)) def createPipelineConfigTask = project.tasks.register("createPipelineConfig", Copy) { Copy task -> @@ -197,13 +197,9 @@ if (project.findProject(BuildUtils.getTestProjectPath(project.gradle)) != null & return newLine }) - task.destinationDir = new File(configDir) + task.destinationDir = configDir if (BuildUtils.useEmbeddedTomcat(project)) { - task.doFirst { - new File(new File(BuildUtils.getEmbeddedConfigPath(project)), "application.properties") << "\n${configDir}" - } - rootProject.allprojects { task.mustRunAfter tasks.withType(DoThenSetup) } @@ -213,7 +209,8 @@ if (project.findProject(BuildUtils.getTestProjectPath(project.gradle)) != null & dependsOn(createPipelineConfigTask) if (BuildUtils.useEmbeddedTomcat(project)) { it.doFirst { - new File(new File(BuildUtils.getEmbeddedConfigPath(project)), "application.properties") << "\ncontext.pipelineConfig=${configDir}" + new File(new File(BuildUtils.getEmbeddedConfigPath(project)), "application.properties") + << "\ncontext.pipelineConfig=${configDir.getAbsolutePath().replace("\\", "\\\\")}" } } } diff --git a/SequenceAnalysis/src/org/labkey/sequenceanalysis/SequenceRemoteIntegrationTests.java b/SequenceAnalysis/src/org/labkey/sequenceanalysis/SequenceRemoteIntegrationTests.java index faa074c82..3a1ecf590 100644 --- a/SequenceAnalysis/src/org/labkey/sequenceanalysis/SequenceRemoteIntegrationTests.java +++ b/SequenceAnalysis/src/org/labkey/sequenceanalysis/SequenceRemoteIntegrationTests.java @@ -83,10 +83,12 @@ private File setupConfigDir(File outDir) throws IOException path = path.replaceAll("\\\\", "/"); line = line.replaceAll("@@SEQUENCEANALYSIS_TOOLS@@", path); + _log.info("Writing to pipelineConfig.xml: " + line); } else if (line.contains("@@WORK_DIR@@")) { line = line.replaceAll("@@WORK_DIR@@", outDir.getPath().replaceAll("\\\\", "/")); + _log.info("Writing to pipelineConfig.xml: " + line); } writer.println(line); @@ -213,6 +215,8 @@ protected void executeJobRemote(File workDir, @Nullable File jobJson) throws IOE ProcessBuilder pb = new ProcessBuilder(args); pb.directory(workDir); + _log.info("Executing job in '" + pb.directory().getAbsolutePath() + "': " + String.join(" ", pb.command())); + Process proc; try {