You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by vl...@apache.org on 2019/09/28 16:17:43 UTC
[jmeter] branch master updated: Increase "batch server" startup
timeout to 15sec
This is an automated email from the ASF dual-hosted git repository.
vladimirsitnikov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git
The following commit(s) were added to refs/heads/master by this push:
new aed3359 Increase "batch server" startup timeout to 15sec
aed3359 is described below
commit aed3359c90edf062709147b7096e5f2d7e493e95
Author: Vladimir Sitnikov <si...@gmail.com>
AuthorDate: Sat Sep 28 19:17:30 2019 +0300
Increase "batch server" startup timeout to 15sec
The timeout is configurable via -PbatchTestServerStartupTimeout=PT30S
The format follows java.text.Duration
---
.../jmeter/buildtools/batchtest/BatchTestServer.kt | 8 +++++++-
src/dist-check/build.gradle.kts | 18 +++++++++++++++++-
2 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/buildSrc/subprojects/batchtest/src/main/kotlin/org/apache/jmeter/buildtools/batchtest/BatchTestServer.kt b/buildSrc/subprojects/batchtest/src/main/kotlin/org/apache/jmeter/buildtools/batchtest/BatchTestServer.kt
index a983773..5618f3e 100644
--- a/buildSrc/subprojects/batchtest/src/main/kotlin/org/apache/jmeter/buildtools/batchtest/BatchTestServer.kt
+++ b/buildSrc/subprojects/batchtest/src/main/kotlin/org/apache/jmeter/buildtools/batchtest/BatchTestServer.kt
@@ -20,9 +20,11 @@ package org.apache.jmeter.buildtools.batchtest
import org.gradle.api.GradleException
import org.gradle.api.model.ObjectFactory
+import org.gradle.api.tasks.Input
import org.gradle.api.tasks.Internal
import org.gradle.api.tasks.OutputFile
import org.gradle.kotlin.dsl.findByType
+import org.gradle.kotlin.dsl.property
import org.gradle.testing.jacoco.plugins.JacocoTaskExtension
import java.io.File
import java.net.ConnectException
@@ -47,6 +49,10 @@ open class BatchTestServer @Inject constructor(objects: ObjectFactory) : BatchTe
val jacocoExecFile = objects.fileProperty()
.convention(project.layout.buildDirectory.file("jacoco/$name.exec"))
+ @Input
+ val startupTimeout = objects.property<Duration>()
+ .convention(Duration.ofSeconds(15))
+
private fun deleteWorkfiles() {
project.delete(serverLogFile)
}
@@ -128,7 +134,7 @@ open class BatchTestServer @Inject constructor(objects: ObjectFactory) : BatchTe
.assertNormalExitValue()
}
- waitForPort(serverHost, serverPort, Duration.ofSeconds(5))
+ waitForPort(serverHost, serverPort, startupTimeout.get())
super.exec()
try {
diff --git a/src/dist-check/build.gradle.kts b/src/dist-check/build.gradle.kts
index a78d5ac..cbd1cba 100644
--- a/src/dist-check/build.gradle.kts
+++ b/src/dist-check/build.gradle.kts
@@ -18,6 +18,7 @@
import org.apache.jmeter.buildtools.batchtest.BatchTest
import org.apache.jmeter.buildtools.batchtest.BatchTestServer
+import java.time.Duration
plugins {
jmeterbuild.batchtest
@@ -209,7 +210,22 @@ for (impl in arrayOf("Java", "HttpClient4")) {
// Note: original build.xml seem to use Bug54685 test, however in fact batchtestserver target
// just ignored the given filename
-createBatchServerTestTask("BatchTestLocal")
+val batchTestServerStartupTimeout: String? by project
+val batchTestServerStartupTimeoutDuration =
+ batchTestServerStartupTimeout?.let {
+ try {
+ Duration.parse(it)
+ } catch (e: Exception) {
+ throw IllegalArgumentException(
+ "Unable to parse the value of batchTestServerStartupTimeout property as duration $it." +
+ " Please ensure it follows java.time.Duration format (e.g. PT5S)", e
+ )
+ }
+ }
+
+createBatchServerTestTask("BatchTestLocal") {
+ batchTestServerStartupTimeoutDuration?.let { startupTimeout.set(it) }
+}
tasks.named(JavaPlugin.TEST_TASK_NAME).configure {
// Test examine JAR contents in /lib/..., so we need to copy jars to the projectRoot/lib/