Skip to content
Snippets Groups Projects
Commit b4580b24 authored by Lorenz Boguhn's avatar Lorenz Boguhn
Browse files

Fix Test: Change from Action test to ActionCommand test

parent e0c0ce5f
No related branches found
No related tags found
1 merge request!237Enhance exception handling of ActionCommands
Pipeline #6542 passed
...@@ -114,15 +114,26 @@ class ActionCommandTest { ...@@ -114,15 +114,26 @@ class ActionCommandTest {
} }
@Test @Test
fun testActionFailed() { fun testActionCommandSuccess(){
val action = Action() val actionCommand = ActionCommand(server.client)
action.selector = ActionSelector() val label = mutableMapOf("app" to "pod")
action.selector.pod = PodSelector() val command = arrayOf("ls")
action.selector.pod.matchLabels = mutableMapOf("app" to "pod") val timeoutSeconds = 10L
action.exec = Command()
action.exec.command = arrayOf("error-command") actionCommand.exec(label,command,timeoutSeconds)
action.exec.timeoutSeconds = 10L 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)} }
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment