Skip to content

Commit

Permalink
Accept any sidecar termination Reason as success
Browse files Browse the repository at this point in the history
Fixes #1253

When a sidecar is forcefully exited by the taskrun controller it may
error out. This happens because the sidecar is terminated by having its
image field rewritten to be tekton's nop container. The nop container is
bare bones and probably doesnt contain the entrypoint command configured
for the sidecar. When this occurs the container will exit with an error
of some kind. On GKE this error's Reason is "ContainerCannotRun" but on
MiniShift/OpenShift the error Reason is "Error".

The sidecar e2e test previously required a termination Reason of
"ContainerCannotRun" or "Completed" but this appears to be too rigid.
Instead the test now considers a sidecar that has been terminated for
any reason to be a success.
  • Loading branch information
Scott authored and tekton-robot committed Sep 3, 2019
1 parent c2d28bc commit e7df1fb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/sidecar_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,14 @@ func TestSidecarTaskSupport(t *testing.T) {
for _, c := range pod.Status.ContainerStatuses {
if c.Name == fmt.Sprintf("step-%s", primaryContainerName) {
if c.State.Terminated == nil || c.State.Terminated.Reason != "Completed" {
t.Errorf("Primary container did not terminate as expected, Terminated state: %v", c.State.Terminated)
t.Errorf("Primary container has nil Terminated state or did not complete successfully. Actual Terminated state: %v", c.State.Terminated)
} else {
primaryTerminated = true
}
}
if c.Name == sidecarContainerName {
if c.State.Terminated == nil || (c.State.Terminated.Reason != "Completed" && c.State.Terminated.Reason != "ContainerCannotRun") {
t.Errorf("Sidecar container did not terminate as expected, Terminated state: %v", c.State.Terminated)
if c.State.Terminated == nil {
t.Errorf("Sidecar container has a nil Terminated status but non-nil is expected.")
} else {
sidecarTerminated = true
}
Expand Down

0 comments on commit e7df1fb

Please sign in to comment.