Skip to content

Commit

Permalink
Make Gradle IT tests debuggable (elastic#58093)
Browse files Browse the repository at this point in the history
- This configures the testkit gradle runner to run with debug enabled automatically when
test is executed in debug mode (e.g. from the IDE)
- Allows step by step debugging of GradleIntegrationTestCase tests
  • Loading branch information
breskeby authored Jun 15, 2020
1 parent 175c220 commit b9bba79
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.io.File;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.lang.management.ManagementFactory;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
Expand Down Expand Up @@ -43,7 +44,11 @@ protected GradleRunner getGradleRunner(String sampleProject) {
} catch (IOException e) {
throw new UncheckedIOException(e);
}
return GradleRunner.create().withProjectDir(getProjectDir(sampleProject)).withPluginClasspath().withTestKitDir(testkit);
return GradleRunner.create()
.withProjectDir(getProjectDir(sampleProject))
.withPluginClasspath()
.withTestKitDir(testkit)
.withDebug(ManagementFactory.getRuntimeMXBean().getInputArguments().toString().indexOf("-agentlib:jdwp") > 0);
}

protected File getBuildDir(String name) {
Expand Down

0 comments on commit b9bba79

Please sign in to comment.