From 852a54b31c8793fcb60d56c5a29b0603bbede861 Mon Sep 17 00:00:00 2001
From: "stu126940@mail.uni-kiel.de" <stu126940@mail.uni-kiel.de>
Date: Tue, 4 Jan 2022 16:08:48 +0100
Subject: [PATCH] small fixes, cleanup

---
 .../src/main/kotlin/theodolite/benchmark/ActionCommand.kt | 8 ++++----
 .../test/kotlin/theodolite/benchmark/ActionCommandTest.kt | 1 -
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/theodolite/src/main/kotlin/theodolite/benchmark/ActionCommand.kt b/theodolite/src/main/kotlin/theodolite/benchmark/ActionCommand.kt
index ca5ca7993..e63f73307 100644
--- a/theodolite/src/main/kotlin/theodolite/benchmark/ActionCommand.kt
+++ b/theodolite/src/main/kotlin/theodolite/benchmark/ActionCommand.kt
@@ -54,7 +54,7 @@ class ActionCommand(val client: NamespacedKubernetesClient) {
                 .writingOutput(out)
                 .writingError(error)
                 .writingErrorChannel(errChannelStream)
-                .usingListener(MyPodExecListener(execLatch))
+                .usingListener(ActionCommandListener(execLatch))
                 .exec(*command)
 
             val latchTerminationStatus = execLatch.await(timeout, TimeUnit.SECONDS);
@@ -105,7 +105,7 @@ class ActionCommand(val client: NamespacedKubernetesClient) {
             }.toInt()
     }
 
-    fun getPodName(matchLabels: MutableMap<String, String>, tries: Int): String {
+    private fun getPodName(matchLabels: MutableMap<String, String>, tries: Int): String {
         for (i in 1..tries) {
 
             try {
@@ -136,13 +136,13 @@ class ActionCommand(val client: NamespacedKubernetesClient) {
         }
     }
 
-    private class MyPodExecListener(val execLatch: CountDownLatch) : ExecListener {
+    private class ActionCommandListener(val execLatch: CountDownLatch) : ExecListener {
         override fun onOpen(response: Response) {
         }
 
         override fun onFailure(throwable: Throwable, response: Response) {
             execLatch.countDown()
-            throw ActionCommandFailedException("Some error encountered while executing action.", throwable)
+            throw ActionCommandFailedException("Some error encountered while executing action, caused ${throwable.message})")
         }
 
         override fun onClose(code: Int, reason: String) {
diff --git a/theodolite/src/test/kotlin/theodolite/benchmark/ActionCommandTest.kt b/theodolite/src/test/kotlin/theodolite/benchmark/ActionCommandTest.kt
index f6ef7d912..71001ac6f 100644
--- a/theodolite/src/test/kotlin/theodolite/benchmark/ActionCommandTest.kt
+++ b/theodolite/src/test/kotlin/theodolite/benchmark/ActionCommandTest.kt
@@ -8,7 +8,6 @@ import io.fabric8.kubernetes.client.utils.Utils
 import io.quarkus.test.junit.QuarkusTest
 import org.junit.jupiter.api.*
 import org.junit.jupiter.api.Assertions.assertEquals
-import org.junit.jupiter.api.Assertions.assertTrue
 import theodolite.execution.operator.TheodoliteController
 import theodolite.execution.operator.TheodoliteOperator
 import theodolite.util.ActionCommandFailedException
-- 
GitLab