From e8dc54ba04f323f45d3b6038020c080ce008670c Mon Sep 17 00:00:00 2001 From: Antonio Murdaca Date: Sun, 28 May 2017 19:00:48 +0200 Subject: [PATCH] server: correctly fill ctr termination reason This patch fixes all port forwarding e2e tests. Those tests were specifically looking for a termination reason to say that a given container has finished running. CRI-O wasn't actually returning any reason field for an exited container. -> https://github.com/kubernetes/kubernetes/blob/master/test/e2e/portforward.go#L116 -> https://github.com/kubernetes/kubernetes/blob/master/test/utils/conditions.go#L97 Signed-off-by: Antonio Murdaca --- server/container_status.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server/container_status.go b/server/container_status.go index fc8c18ce..3320365f 100644 --- a/server/container_status.go +++ b/server/container_status.go @@ -98,8 +98,13 @@ func (s *Server) ContainerStatus(ctx context.Context, req *pb.ContainerStatusReq finished := cState.Finished.UnixNano() resp.Status.FinishedAt = finished resp.Status.ExitCode = cState.ExitCode - if cState.OOMKilled { + switch { + case cState.OOMKilled: resp.Status.Reason = "OOMKilled" + case cState.ExitCode == 0: + resp.Status.Reason = "Completed" + default: + resp.Status.Reason = "Error" } }