Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node E2E: add termination message test #23969

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
39 changes: 39 additions & 0 deletions test/e2e_node/runtime_conformance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,45 @@ while true; do sleep 1; done
Eventually(terminateContainer.Present, retryTimeout, pollInterval).Should(BeFalse())
}
})

It("should report termination message if TerminationMessagePath is set [Conformance]", func() {
name := "termination-message-container"
terminationMessage := "DONE"
terminationMessagePath := "/dev/termination-log"
c := ConformanceContainer{
Container: api.Container{
Image: ImageRegistry[busyBoxImage],
Name: name,
Command: []string{"/bin/sh", "-c"},
Args: []string{fmt.Sprintf("/bin/echo -n %s > %s", terminationMessage, terminationMessagePath)},
TerminationMessagePath: terminationMessagePath,
},
Client: f.Client,
RestartPolicy: api.RestartPolicyNever,
NodeName: *nodeName,
Namespace: f.Namespace.Name,
}

By("create the container")
Expect(c.Create()).To(Succeed())
defer c.Delete()

By("wait for the container to succeed")
Eventually(c.GetPhase, retryTimeout, pollInterval).Should(Equal(api.PodSucceeded))

By("get the container status")
status, err := c.GetStatus()
Expect(err).NotTo(HaveOccurred())

By("the container should be terminated")
Expect(GetContainerState(status.State)).To(Equal(ContainerStateTerminated))

By("the termination message should be set")
Expect(status.State.Terminated.Message).Should(Equal(terminationMessage))

By("delete the container")
Expect(c.Delete()).To(Succeed())
})
})

Context("when running a container with a new image", func() {
Expand Down