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
61c4958d
Commit
61c4958d
authored
Mar 11, 2016
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #22859 from pwittrock/flaky-node
Auto commit by PR queue bot
parents
c9977cc7
ce2d2c84
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
18 deletions
+22
-18
kubelet_test.go
test/e2e_node/kubelet_test.go
+22
-18
No files found.
test/e2e_node/kubelet_test.go
View file @
61c4958d
...
...
@@ -44,12 +44,14 @@ var _ = Describe("Kubelet", func() {
})
Describe
(
"pod scheduling"
,
func
()
{
namespace
:=
"pod-scheduling"
Context
(
"when scheduling a busybox command in a pod"
,
func
()
{
podName
:=
"busybox-scheduling"
It
(
"it should return succes"
,
func
()
{
pod
:=
&
api
.
Pod
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"busybox"
,
Namespace
:
api
.
NamespaceDefault
,
Name
:
podName
,
Namespace
:
namespace
,
},
Spec
:
api
.
PodSpec
{
// Force the Pod to schedule to the node without a scheduler running
...
...
@@ -59,20 +61,20 @@ var _ = Describe("Kubelet", func() {
Containers
:
[]
api
.
Container
{
{
Image
:
"gcr.io/google_containers/busybox"
,
Name
:
"busybox"
,
Name
:
podName
,
Command
:
[]
string
{
"echo"
,
"'Hello World'"
},
},
},
},
}
_
,
err
:=
cl
.
Pods
(
api
.
NamespaceDefault
)
.
Create
(
pod
)
_
,
err
:=
cl
.
Pods
(
namespace
)
.
Create
(
pod
)
Expect
(
err
)
.
To
(
BeNil
(),
fmt
.
Sprintf
(
"Error creating Pod %v"
,
err
))
})
It
(
"it should print the output to logs"
,
func
()
{
Eventually
(
func
()
string
{
sinceTime
:=
unversioned
.
NewTime
(
time
.
Now
()
.
Add
(
time
.
Duration
(
-
1
*
time
.
Hour
)))
rc
,
err
:=
cl
.
Pods
(
api
.
NamespaceDefault
)
.
GetLogs
(
"busybox"
,
&
api
.
PodLogOptions
{
SinceTime
:
&
sinceTime
})
.
Stream
()
rc
,
err
:=
cl
.
Pods
(
namespace
)
.
GetLogs
(
podName
,
&
api
.
PodLogOptions
{
SinceTime
:
&
sinceTime
})
.
Stream
()
if
err
!=
nil
{
return
""
}
...
...
@@ -84,18 +86,19 @@ var _ = Describe("Kubelet", func() {
})
It
(
"it should be possible to delete"
,
func
()
{
err
:=
cl
.
Pods
(
api
.
NamespaceDefault
)
.
Delete
(
"busybox"
,
&
api
.
DeleteOptions
{})
Expect
(
err
)
.
To
(
BeNil
(),
fmt
.
Sprintf
(
"Error
crea
ting Pod %v"
,
err
))
err
:=
cl
.
Pods
(
namespace
)
.
Delete
(
podName
,
&
api
.
DeleteOptions
{})
Expect
(
err
)
.
To
(
BeNil
(),
fmt
.
Sprintf
(
"Error
dele
ting Pod %v"
,
err
))
})
})
Context
(
"when scheduling a read only busybox container"
,
func
()
{
podName
:=
"busybox-readonly-fs"
It
(
"it should return success"
,
func
()
{
isReadOnly
:=
true
pod
:=
&
api
.
Pod
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"busybox"
,
Namespace
:
api
.
NamespaceDefault
,
Name
:
podName
,
Namespace
:
namespace
,
},
Spec
:
api
.
PodSpec
{
// Force the Pod to schedule to the node without a scheduler running
...
...
@@ -105,7 +108,7 @@ var _ = Describe("Kubelet", func() {
Containers
:
[]
api
.
Container
{
{
Image
:
"gcr.io/google_containers/busybox"
,
Name
:
"busybox"
,
Name
:
podName
,
Command
:
[]
string
{
"sh"
,
"-c"
,
"echo test > /file"
},
SecurityContext
:
&
api
.
SecurityContext
{
ReadOnlyRootFilesystem
:
&
isReadOnly
,
...
...
@@ -114,13 +117,13 @@ var _ = Describe("Kubelet", func() {
},
},
}
_
,
err
:=
cl
.
Pods
(
api
.
NamespaceDefault
)
.
Create
(
pod
)
_
,
err
:=
cl
.
Pods
(
namespace
)
.
Create
(
pod
)
Expect
(
err
)
.
To
(
BeNil
(),
fmt
.
Sprintf
(
"Error creating Pod %v"
,
err
))
})
It
(
"it should not write to the root filesystem"
,
func
()
{
Eventually
(
func
()
string
{
rc
,
err
:=
cl
.
Pods
(
api
.
NamespaceDefault
)
.
GetLogs
(
"busybox"
,
&
api
.
PodLogOptions
{})
.
Stream
()
rc
,
err
:=
cl
.
Pods
(
namespace
)
.
GetLogs
(
podName
,
&
api
.
PodLogOptions
{})
.
Stream
()
if
err
!=
nil
{
return
""
}
...
...
@@ -132,13 +135,14 @@ var _ = Describe("Kubelet", func() {
})
It
(
"it should be possible to delete"
,
func
()
{
err
:=
cl
.
Pods
(
api
.
NamespaceDefault
)
.
Delete
(
"busybox"
,
&
api
.
DeleteOptions
{})
err
:=
cl
.
Pods
(
namespace
)
.
Delete
(
podName
,
&
api
.
DeleteOptions
{})
Expect
(
err
)
.
To
(
BeNil
(),
fmt
.
Sprintf
(
"Error creating Pod %v"
,
err
))
})
})
})
Describe
(
"metrics api"
,
func
()
{
namespace
:=
"kubelet-metrics-api"
statsPrefix
:=
"stats-busybox-"
podNames
:=
[]
string
{}
podCount
:=
2
...
...
@@ -147,7 +151,7 @@ var _ = Describe("Kubelet", func() {
}
BeforeEach
(
func
()
{
for
_
,
podName
:=
range
podNames
{
createPod
(
cl
,
podName
,
[]
api
.
Container
{
createPod
(
cl
,
podName
,
namespace
,
[]
api
.
Container
{
{
Image
:
"gcr.io/google_containers/busybox"
,
Command
:
[]
string
{
"sh"
,
"-c"
,
"echo 'Hello World' | tee ~/file | tee /test-empty-dir-mnt | sleep 60"
},
...
...
@@ -259,7 +263,7 @@ var _ = Describe("Kubelet", func() {
AfterEach
(
func
()
{
for
_
,
podName
:=
range
podNames
{
err
:=
cl
.
Pods
(
api
.
NamespaceDefault
)
.
Delete
(
podName
,
&
api
.
DeleteOptions
{})
err
:=
cl
.
Pods
(
namespace
)
.
Delete
(
podName
,
&
api
.
DeleteOptions
{})
Expect
(
err
)
.
To
(
BeNil
(),
fmt
.
Sprintf
(
"Error deleting Pod %v"
,
podName
))
}
})
...
...
@@ -284,11 +288,11 @@ const (
containerSuffix
=
"-c"
)
func
createPod
(
cl
*
client
.
Client
,
podName
string
,
containers
[]
api
.
Container
,
volumes
[]
api
.
Volume
)
{
func
createPod
(
cl
*
client
.
Client
,
podName
string
,
namespace
string
,
containers
[]
api
.
Container
,
volumes
[]
api
.
Volume
)
{
pod
:=
&
api
.
Pod
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
podName
,
Namespace
:
api
.
NamespaceDefault
,
Namespace
:
namespace
,
},
Spec
:
api
.
PodSpec
{
// Force the Pod to schedule to the node without a scheduler running
...
...
@@ -299,6 +303,6 @@ func createPod(cl *client.Client, podName string, containers []api.Container, vo
Volumes
:
volumes
,
},
}
_
,
err
:=
cl
.
Pods
(
api
.
NamespaceDefault
)
.
Create
(
pod
)
_
,
err
:=
cl
.
Pods
(
namespace
)
.
Create
(
pod
)
Expect
(
err
)
.
To
(
BeNil
(),
fmt
.
Sprintf
(
"Error creating Pod %v"
,
err
))
}
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