From b4580b24a13638628b591a011c8e69aa8cd506d1 Mon Sep 17 00:00:00 2001
From: lorenz <stu203404@mail.uni-kiel.de>
Date: Mon, 14 Feb 2022 15:08:50 +0100
Subject: [PATCH] Fix Test: Change from Action test to ActionCommand test

---
 .../theodolite/benchmark/ActionCommandTest.kt | 29 +++++++++++++------
 1 file changed, 20 insertions(+), 9 deletions(-)

diff --git a/theodolite/src/test/kotlin/theodolite/benchmark/ActionCommandTest.kt b/theodolite/src/test/kotlin/theodolite/benchmark/ActionCommandTest.kt
index 0e40fca5c..495190275 100644
--- a/theodolite/src/test/kotlin/theodolite/benchmark/ActionCommandTest.kt
+++ b/theodolite/src/test/kotlin/theodolite/benchmark/ActionCommandTest.kt
@@ -114,15 +114,26 @@ class ActionCommandTest {
     }
 
     @Test
-    fun testActionFailed() {
-        val action = Action()
-        action.selector = ActionSelector()
-        action.selector.pod = PodSelector()
-        action.selector.pod.matchLabels = mutableMapOf("app" to "pod")
-        action.exec = Command()
-        action.exec.command = arrayOf("error-command")
-        action.exec.timeoutSeconds = 10L
+    fun testActionCommandSuccess(){
+        val actionCommand = ActionCommand(server.client)
+        val label = mutableMapOf("app" to "pod")
+        val command = arrayOf("ls")
+        val timeoutSeconds = 10L
+
+        actionCommand.exec(label,command,timeoutSeconds)
+        assertEquals(
+            "/api/v1/namespaces/test/pods/pod1/exec?command=ls&stdout=true&stderr=true",
+            server.lastRequest.path)
+    }
+
+
+    @Test
+    fun testActionCommandFailed() {
+        val actionCommand = ActionCommand(server.client)
+        val label = mutableMapOf("app" to "pod")
+        val command = arrayOf("error-command")
+        val timeoutSeconds = 10L
 
-        assertThrows<ActionCommandFailedException> { run { action.exec(server.client) } }
+        assertThrows<ActionCommandFailedException> { run { actionCommand.exec(label,command,timeoutSeconds)} }
     }
 }
-- 
GitLab