Container STATE is Error when the Test Result has Failure Container STATE is Error when the Test Result has Failure kubernetes kubernetes

Container STATE is Error when the Test Result has Failure


As per TestNG exit codes:

When TestNG completes execution, it exits with a return code. This return code can be inspected to get an idea on the nature of failures (if there were any). The following table summarises the different exit codes that TestNG currently uses.

/** * |---------------------|---------|--------|-------------|------------------------------------------| * | FailedWithinSuccess | Skipped | Failed | Status Code | Remarks                                  | * |---------------------|---------|--------|-------------|------------------------------------------| * | 0                   | 0       | 0      | 0           | Passed tests                             | * | 0                   | 0       | 1      | 1           | Failed tests                             | * | 0                   | 1       | 0      | 2           | Skipped tests                            | * | 0                   | 1       | 1      | 3           | Skipped/Failed tests                     | * | 1                   | 0       | 0      | 4           | FailedWithinSuccess tests                | * | 1                   | 0       | 1      | 5           | FailedWithinSuccess/Failed tests         | * | 1                   | 1       | 0      | 6           | FailedWithinSuccess/Skipped tests        | * | 1                   | 1       | 1      | 7           | FailedWithinSuccess/Skipped/Failed tests | * |---------------------|---------|--------|-------------|------------------------------------------| */

Your container is probably using the TestNG as the main process, and any test that is not considered Passed tests (i.e., exit code different than 0) will result in a pod with the terminated/error state.

You can confirm this by Determining the Reason for Pod Failure.

e.g: You can check your pod state; the output will be something like this:

$ kubectl get my-pod-name -o=json | jq .status.containerStatuses[].state{  "terminated": {    "containerID": "docker://9bc2497ec0d2bc3b1b62483c217aaaaa1027102a5f7ff1688f47b94254",    "exitCode": 1,    "finishedAt": "2019-10-28T02:00:10Z",    "reason": "Error",    "startedAt": "2019-10-28T02:00:05Z"  }}

and check if the exit code matches your TestNG status code.