Enhance exception handling of ActionCommands
2 unresolved threads
Fix #337 Catches exceptions in the Action excec method. Otherwise can the setup and teardown methods are interruppted and the kafka topics are not removed after an experiment.
fix NullPointer exception by FindAndFirst() by checking for failture first enhance normal logging in case of problematic commands
Merge request reports
Activity
added 1 commit
- b4580b24 - Fix Test: Change from Action test to ActionCommand test
23 val exitCode = ActionCommand(client = client) 24 .exec( 25 matchLabels = selector.pod.matchLabels, 26 container = selector.container, 27 timeout = exec.timeoutSeconds, 28 command = exec.command 29 ) 26 30 if(exitCode != 0){ 27 throw ActionCommandFailedException("Error while executing action, finished with exit code $exitCode") 31 logger.info("Actions exit code was not zero instead: $exitCode") 32 logger.info("Selector: ${selector.pod.matchLabels}, container: ${selector.container}") 33 logger.info("Command: ${exec.command.joinToString(separator = " ")}") 34 } 35 } 36 catch (e: Exception){ 37 logger.info { e.stackTraceToString() } assigned to @she
mentioned in issue #337
95 95 96 96 return if (status.status.equals("Success")) { 97 97 0 98 } else status.details.causes.stream() 98 } else if (status.status.equals("Failure")){ 99 throw ActionCommandFailedException("Could not determine the exit code, status is failure") 100 } 101 else { status.details.causes.stream() 99 102 .filter { it.reason.equals("ExitCode") } Condition should be
it.reason != null && it.reason.equals("ExitCode")
in order to prevent NullPointerException. Also, when the NullPointerException is prevented, the original Error is logged to stdout which makes the behaviour of the application more comprehensive.Edited by Simon Ehrenstein
changed milestone to %0.8.0
changed milestone to %0.9.0
changed milestone to %0.10.0
Please register or sign in to reply