Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
8969e8c0
Commit
8969e8c0
authored
Jul 05, 2016
by
Random-Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use waiting reason to figure out image pulling error.
parent
332d151d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
12 deletions
+22
-12
runtime_conformance_test.go
test/e2e_node/runtime_conformance_test.go
+22
-12
No files found.
test/e2e_node/runtime_conformance_test.go
View file @
8969e8c0
...
@@ -24,6 +24,7 @@ import (
...
@@ -24,6 +24,7 @@ import (
"time"
"time"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
kubecontainer
"k8s.io/kubernetes/pkg/kubelet/container"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/test/e2e/framework"
"k8s.io/kubernetes/test/e2e/framework"
...
@@ -187,44 +188,44 @@ while true; do sleep 1; done
...
@@ -187,44 +188,44 @@ while true; do sleep 1; done
image
string
image
string
secret
bool
secret
bool
phase
api
.
PodPhase
phase
api
.
PodPhase
state
ContainerState
waiting
bool
}{
}{
{
{
description
:
"should not be able to pull image from invalid registry"
,
description
:
"should not be able to pull image from invalid registry"
,
image
:
"invalid.com/invalid/alpine:3.1"
,
image
:
"invalid.com/invalid/alpine:3.1"
,
phase
:
api
.
PodPending
,
phase
:
api
.
PodPending
,
state
:
ContainerStateWaiting
,
waiting
:
true
,
},
},
{
{
description
:
"should not be able to pull non-existing image from gcr.io"
,
description
:
"should not be able to pull non-existing image from gcr.io"
,
image
:
"gcr.io/google_containers/invalid-image:invalid-tag"
,
image
:
"gcr.io/google_containers/invalid-image:invalid-tag"
,
phase
:
api
.
PodPending
,
phase
:
api
.
PodPending
,
state
:
ContainerStateWaiting
,
waiting
:
true
,
},
},
{
{
description
:
"should be able to pull image from gcr.io"
,
description
:
"should be able to pull image from gcr.io"
,
image
:
NoPullImageRegistry
[
pullTestAlpineWithBash
],
image
:
NoPullImageRegistry
[
pullTestAlpineWithBash
],
phase
:
api
.
PodRunning
,
phase
:
api
.
PodRunning
,
state
:
ContainerStateRunning
,
waiting
:
false
,
},
},
{
{
description
:
"should be able to pull image from docker hub"
,
description
:
"should be able to pull image from docker hub"
,
image
:
NoPullImageRegistry
[
pullTestAlpine
],
image
:
NoPullImageRegistry
[
pullTestAlpine
],
phase
:
api
.
PodRunning
,
phase
:
api
.
PodRunning
,
state
:
ContainerStateRunning
,
waiting
:
false
,
},
},
{
{
description
:
"should not be able to pull from private registry without secret"
,
description
:
"should not be able to pull from private registry without secret"
,
image
:
NoPullImageRegistry
[
pullTestAuthenticatedAlpine
],
image
:
NoPullImageRegistry
[
pullTestAuthenticatedAlpine
],
phase
:
api
.
PodPending
,
phase
:
api
.
PodPending
,
state
:
ContainerStateWaiting
,
waiting
:
true
,
},
},
{
{
description
:
"should be able to pull from private registry with secret"
,
description
:
"should be able to pull from private registry with secret"
,
image
:
NoPullImageRegistry
[
pullTestAuthenticatedAlpine
],
image
:
NoPullImageRegistry
[
pullTestAuthenticatedAlpine
],
secret
:
true
,
secret
:
true
,
phase
:
api
.
PodRunning
,
phase
:
api
.
PodRunning
,
state
:
ContainerStateRunning
,
waiting
:
false
,
},
},
}
{
}
{
testCase
:=
testCase
testCase
:=
testCase
...
@@ -259,15 +260,24 @@ while true; do sleep 1; done
...
@@ -259,15 +260,24 @@ while true; do sleep 1; done
// pod phase first, and the expected pod phase is Pending, the container status may not
// pod phase first, and the expected pod phase is Pending, the container status may not
// even show up when we check it.
// even show up when we check it.
By
(
"check the container state"
)
By
(
"check the container state"
)
getState
:=
func
()
(
ContainerState
,
error
)
{
checkContainerState
:=
func
()
(
bool
,
error
)
{
status
,
err
:=
container
.
GetStatus
()
status
,
err
:=
container
.
GetStatus
()
if
err
!=
nil
{
if
err
!=
nil
{
return
ContainerStateUnknown
,
err
return
false
,
err
}
}
return
GetContainerState
(
status
.
State
),
nil
if
!
testCase
.
waiting
&&
status
.
State
.
Running
!=
nil
{
return
true
,
nil
}
if
testCase
.
waiting
&&
status
.
State
.
Waiting
!=
nil
{
reason
:=
status
.
State
.
Waiting
.
Reason
return
reason
==
kubecontainer
.
ErrImagePull
.
Error
()
||
reason
==
kubecontainer
.
ErrImagePullBackOff
.
Error
(),
nil
}
return
false
,
nil
}
}
Eventually
(
getState
,
retryTimeout
,
pollInterval
)
.
Should
(
Equal
(
testCase
.
state
))
Eventually
(
checkContainerState
,
retryTimeout
,
pollInterval
)
.
Should
(
BeTrue
(
))
Consistently
(
getState
,
consistentCheckTimeout
,
pollInterval
)
.
Should
(
Equal
(
testCase
.
state
))
Consistently
(
checkContainerState
,
consistentCheckTimeout
,
pollInterval
)
.
Should
(
BeTrue
(
))
By
(
"check the pod phase"
)
By
(
"check the pod phase"
)
Expect
(
container
.
GetPhase
())
.
To
(
Equal
(
testCase
.
phase
))
Expect
(
container
.
GetPhase
())
.
To
(
Equal
(
testCase
.
phase
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment