From 315cab2f33e613d6e52e9d6a9eb6636e9b159807 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Champeau?= Date: Mon, 4 Dec 2023 13:45:36 +0100 Subject: [PATCH] Add missing configuration parameter (#900) * Add missing configuration parameter This was left over when upgrading to test resources 2.3.0. Fixes #875 * Add missing docs * Fix property type --- src/docs/asciidoc/index.adoc | 2 +- .../testresources/MicronautTestResourcesPlugin.java | 1 + .../gradle/testresources/TestResourcesConfiguration.java | 9 +++++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/docs/asciidoc/index.adoc b/src/docs/asciidoc/index.adoc index fb014fe8..0179bdf4 100644 --- a/src/docs/asciidoc/index.adoc +++ b/src/docs/asciidoc/index.adoc @@ -1474,6 +1474,7 @@ micronaut { inferClasspath = true // true by default additionalModules.add(JDBC_MYSQL) // empty by default clientTimeout = 60 // in seconds, maximum time to wait for resources to be available, 60s by default + serverIdleTimeoutMinutes = 60 // if the server doesn't receive any request for this amount of time, it will be shut down sharedServer = true // false by default sharedServerNamespace = 'custom' // unset by default } @@ -2020,4 +2021,3 @@ In addition, the official GraalVM plugin makes use of Gradle toolchains support, then we recommend tweaking toolchain detection as described in <<#toolchain-behavior, this section of the documentation>>. In any case, make sure to follow the <<#native-image,configuration instructions>>. - diff --git a/test-resources-plugin/src/main/java/io/micronaut/gradle/testresources/MicronautTestResourcesPlugin.java b/test-resources-plugin/src/main/java/io/micronaut/gradle/testresources/MicronautTestResourcesPlugin.java index 13e04840..9262b536 100644 --- a/test-resources-plugin/src/main/java/io/micronaut/gradle/testresources/MicronautTestResourcesPlugin.java +++ b/test-resources-plugin/src/main/java/io/micronaut/gradle/testresources/MicronautTestResourcesPlugin.java @@ -244,6 +244,7 @@ private TaskProvider createStartServiceTask(Configura task.getAccessToken().convention(accessToken); task.getExplicitPort().convention(config.getExplicitPort()); task.getClientTimeout().convention(config.getClientTimeout()); + task.getServerIdleTimeoutMinutes().convention(config.getServerIdleTimeoutMinutes()); task.getClasspath().from(server); task.getForeground().convention(false); task.getStopFile().set(stopFile.toFile()); diff --git a/test-resources-plugin/src/main/java/io/micronaut/gradle/testresources/TestResourcesConfiguration.java b/test-resources-plugin/src/main/java/io/micronaut/gradle/testresources/TestResourcesConfiguration.java index 534c19b7..eff45c55 100644 --- a/test-resources-plugin/src/main/java/io/micronaut/gradle/testresources/TestResourcesConfiguration.java +++ b/test-resources-plugin/src/main/java/io/micronaut/gradle/testresources/TestResourcesConfiguration.java @@ -101,4 +101,13 @@ public interface TestResourcesConfiguration extends KnownModules { * @return the namespace */ Property getSharedServerNamespace(); + + /** + * Server idle timeout, in minutes. If the server + * doesn't receive any request for this amount of + * time, it will stop itself. + * + * @return the server idle timeout + */ + Property getServerIdleTimeoutMinutes(); }