Fixing bug in Java 11 where test doesn't actually run.
diff --git a/src/main/kotlin/com/thelastpickle/tlpstress/commands/Run.kt b/src/main/kotlin/com/thelastpickle/tlpstress/commands/Run.kt index 7234c0c..a35f200 100644 --- a/src/main/kotlin/com/thelastpickle/tlpstress/commands/Run.kt +++ b/src/main/kotlin/com/thelastpickle/tlpstress/commands/Run.kt
@@ -25,6 +25,7 @@ import java.io.File import java.lang.RuntimeException import kotlin.concurrent.fixedRateTimer +import kotlin.concurrent.thread class NoSplitter : IParameterSplitter { override fun split(value: String?): MutableList<String> { @@ -34,6 +35,10 @@ } +/** + * command is the original command that started the program. + * It's used solely for logging and reporting purposes. + */ @Parameters(commandDescription = "Run a tlp-stress profile") class Run(val command: String) : IStressCommand { @@ -272,14 +277,22 @@ populateData(plugin, runners, metrics) - println("Starting main runner") - metrics.startReporting() - runnersExecuted = runners.parallelStream().map { - println("Running") - it.run() - }.count() + println("Starting main runner") + + val threads = mutableListOf<Thread>() + for (runner in runners) { + val t = thread(start = true, isDaemon = true) { + runner.run() + } + + threads.add(t) + } + + for (t in threads) { + t.join() + } Thread.sleep(1000) @@ -288,7 +301,7 @@ reporter.report() } } catch (e: Exception) { - println("There was an error with tlp-stress. Please file a bug at https://github.com/thelastpickle/tlp-stress and report the following exception:\n $e") + println("There was an error with tlp-stress. Please file a bug at https://github.com/rustyrazorblade/tlp-stress and report the following exception:\n $e") throw e } finally { // we need to be able to run multiple tests in the same JVM @@ -301,7 +314,6 @@ } - private fun getRateLimiter() = if(rate > 0) { RateLimiter.create(rate.toDouble()) } else null
diff --git a/src/test/kotlin/com/thelastpickle/tlpstress/integration/AllPluginsBasicTest.kt b/src/test/kotlin/com/thelastpickle/tlpstress/integration/AllPluginsBasicTest.kt index 4bc83ce..25225a2 100644 --- a/src/test/kotlin/com/thelastpickle/tlpstress/integration/AllPluginsBasicTest.kt +++ b/src/test/kotlin/com/thelastpickle/tlpstress/integration/AllPluginsBasicTest.kt
@@ -66,6 +66,7 @@ concurrency = 10L partitionValues = 1000 prometheusPort = prometheusPort++ + threads = 2 }.execute() }