fix typo
Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
parent
2f448a0789
commit
5ba76eb911
@ -142,7 +142,7 @@ func (m *kubeGenericRuntimeManager) getImageUser(image string) (*int64, string,
|
|||||||
// isInitContainerFailed returns true under the following conditions:
|
// isInitContainerFailed returns true under the following conditions:
|
||||||
// 1. container has exited and exitcode is not zero.
|
// 1. container has exited and exitcode is not zero.
|
||||||
// 2. container in unknown state.
|
// 2. container in unknown state.
|
||||||
// 3. container occurs OOMKilled.
|
// 3. container gets OOMKilled.
|
||||||
func isInitContainerFailed(status *kubecontainer.Status) bool {
|
func isInitContainerFailed(status *kubecontainer.Status) bool {
|
||||||
// When oomkilled occurs, init container should be considered as a failure.
|
// When oomkilled occurs, init container should be considered as a failure.
|
||||||
if status.Reason == "OOMKilled" {
|
if status.Reason == "OOMKilled" {
|
||||||
|
@ -51,14 +51,14 @@ func TestIsInitContainerFailed(t *testing.T) {
|
|||||||
ExitCode: 1,
|
ExitCode: 1,
|
||||||
},
|
},
|
||||||
isFailed: true,
|
isFailed: true,
|
||||||
description: "Init container which state is exited and exitcode is non-zero shoud return true",
|
description: "Init container which in exited state and non-zero exit code should return true",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
status: &kubecontainer.Status{
|
status: &kubecontainer.Status{
|
||||||
State: kubecontainer.ContainerStateUnknown,
|
State: kubecontainer.ContainerStateUnknown,
|
||||||
},
|
},
|
||||||
isFailed: true,
|
isFailed: true,
|
||||||
description: "Init container which state is unknown should return true",
|
description: "Init container which in unknown state should return true",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
status: &kubecontainer.Status{
|
status: &kubecontainer.Status{
|
||||||
@ -66,7 +66,7 @@ func TestIsInitContainerFailed(t *testing.T) {
|
|||||||
ExitCode: 0,
|
ExitCode: 0,
|
||||||
},
|
},
|
||||||
isFailed: true,
|
isFailed: true,
|
||||||
description: "Init container which reason is OOMKilled shoud return true",
|
description: "Init container which reason is OOMKilled should return true",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
status: &kubecontainer.Status{
|
status: &kubecontainer.Status{
|
||||||
@ -74,21 +74,21 @@ func TestIsInitContainerFailed(t *testing.T) {
|
|||||||
ExitCode: 0,
|
ExitCode: 0,
|
||||||
},
|
},
|
||||||
isFailed: false,
|
isFailed: false,
|
||||||
description: "Init container which state is exited and exitcode is zero shoud return false",
|
description: "Init container which in exited state and zero exit code should return false",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
status: &kubecontainer.Status{
|
status: &kubecontainer.Status{
|
||||||
State: kubecontainer.ContainerStateRunning,
|
State: kubecontainer.ContainerStateRunning,
|
||||||
},
|
},
|
||||||
isFailed: false,
|
isFailed: false,
|
||||||
description: "Init container which state is running should return false",
|
description: "Init container which in running state should return false",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
status: &kubecontainer.Status{
|
status: &kubecontainer.Status{
|
||||||
State: kubecontainer.ContainerStateCreated,
|
State: kubecontainer.ContainerStateCreated,
|
||||||
},
|
},
|
||||||
isFailed: false,
|
isFailed: false,
|
||||||
description: "Init container which state is created should return false",
|
description: "Init container which in created state should return false",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for i, test := range tests {
|
for i, test := range tests {
|
||||||
|
Loading…
Reference in New Issue
Block a user