From 60397a4552dd10d63c5070fb1a1f82c3073961b3 Mon Sep 17 00:00:00 2001 From: Cristian Ferretti Date: Tue, 25 Jan 2022 12:32:52 -0500 Subject: [PATCH] Factor out the need for docker compose from docker tasks, to apply only to the ones that really need it. --- Integrations/build.gradle | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/Integrations/build.gradle b/Integrations/build.gradle index 84456ed6db8..e612b984522 100644 --- a/Integrations/build.gradle +++ b/Integrations/build.gradle @@ -68,7 +68,7 @@ idea { JavaPluginConvention java = project.convention.plugins.get('java') as JavaPluginConvention SourceSet test = java.sourceSets.maybeCreate('test') -def runInDocker = { String name, String sourcePath, List command -> +def runInDocker = { String name, String sourcePath, List command, Closure addConfig = {} -> Docker.registerDockerTask(project, name) { copyIn { from(sourcePath) { @@ -89,9 +89,7 @@ def runInDocker = { String name, String sourcePath, List command -> imageName = 'deephaven/py-integrations:local-build' - network = dockerCompose.projectName.toLowerCase() + '_default' - containerDependencies.dependsOn = dockerCompose.upTask - containerDependencies.finalizedBy = dockerCompose.downTask + addConfig(it) dockerfile { // set up the container, env vars - things that aren't likely to change @@ -121,7 +119,19 @@ def runInDocker = { String name, String sourcePath, List command -> } } } -def pyTest = runInDocker("test-py-37", 'python', ['python3', '-m', 'xmlrunner', 'discover', '-v', '-o', '/out/report']) + +// Using Integrations/docker-compose.yml, this will start redpanda and wait until it is running before letting tests proceed. +dockerCompose { + waitForTcpPortsTimeout = Duration.ofMinutes(2) +} + +Closure composeConfig = { task -> + task.network = dockerCompose.projectName.toLowerCase() + '_default' + task.containerDependencies.dependsOn = dockerCompose.upTask + task.containerDependencies.finalizedBy = dockerCompose.downTask +} + +def pyTest = runInDocker("test-py-37", 'python', ['python3', '-m', 'xmlrunner', 'discover', '-v', '-o', '/out/report'], composeConfig) def pyFunctionalTest = runInDocker('py-functional-test', 'python', ['/bin/bash', 'run-functional-tests.sh']) def pyTest2 = runInDocker('test-py-deephaven2', '../pyintegration', ['python3', '-m', 'xmlrunner', 'discover', 'tests', '-v', '-o', '/out/report']) pyTest.configure({ @@ -138,8 +148,3 @@ pyTest2.configure({ onlyIf { TestTools.shouldRunTests(project) } }) tasks.getByName('check').dependsOn(pyTest2) - -// Using Integrations/docker-compose.yml, this will start redpanda and wait until it is running before letting tests proceed. -dockerCompose { - waitForTcpPortsTimeout = Duration.ofMinutes(2) -}