mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 03:41:45 +00:00
Merge pull request #23969 from Random-Liu/add-termination-message-test
Automatic merge from submit-queue Node E2E: add termination message test Based on #23658. This PR: 1) Cleans up the `ConformanceContainer` a bit 2) Add termination message test This test proves #23639, without #23658, the test could not pass. @liangchenye @kubernetes/sig-node
This commit is contained in:
commit
bd9ac8d663
@ -130,6 +130,45 @@ while true; do sleep 1; done
|
|||||||
Eventually(terminateContainer.Present, retryTimeout, pollInterval).Should(BeFalse())
|
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() {
|
Context("when running a container with a new image", func() {
|
||||||
|
Loading…
Reference in New Issue
Block a user