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
ce2d2c84
Commit
ce2d2c84
authored
Mar 03, 2016
by
Phillip Wittrock
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use different pod names and namespaces
parent
a511961c
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 @
ce2d2c84
...
@@ -44,12 +44,14 @@ var _ = Describe("Kubelet", func() {
...
@@ -44,12 +44,14 @@ var _ = Describe("Kubelet", func() {
})
})
Describe
(
"pod scheduling"
,
func
()
{
Describe
(
"pod scheduling"
,
func
()
{
namespace
:=
"pod-scheduling"
Context
(
"when scheduling a busybox command in a pod"
,
func
()
{
Context
(
"when scheduling a busybox command in a pod"
,
func
()
{
podName
:=
"busybox-scheduling"
It
(
"it should return succes"
,
func
()
{
It
(
"it should return succes"
,
func
()
{
pod
:=
&
api
.
Pod
{
pod
:=
&
api
.
Pod
{
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"busybox"
,
Name
:
podName
,
Namespace
:
api
.
NamespaceDefault
,
Namespace
:
namespace
,
},
},
Spec
:
api
.
PodSpec
{
Spec
:
api
.
PodSpec
{
// Force the Pod to schedule to the node without a scheduler running
// Force the Pod to schedule to the node without a scheduler running
...
@@ -59,20 +61,20 @@ var _ = Describe("Kubelet", func() {
...
@@ -59,20 +61,20 @@ var _ = Describe("Kubelet", func() {
Containers
:
[]
api
.
Container
{
Containers
:
[]
api
.
Container
{
{
{
Image
:
"gcr.io/google_containers/busybox"
,
Image
:
"gcr.io/google_containers/busybox"
,
Name
:
"busybox"
,
Name
:
podName
,
Command
:
[]
string
{
"echo"
,
"'Hello World'"
},
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
))
Expect
(
err
)
.
To
(
BeNil
(),
fmt
.
Sprintf
(
"Error creating Pod %v"
,
err
))
})
})
It
(
"it should print the output to logs"
,
func
()
{
It
(
"it should print the output to logs"
,
func
()
{
Eventually
(
func
()
string
{
Eventually
(
func
()
string
{
sinceTime
:=
unversioned
.
NewTime
(
time
.
Now
()
.
Add
(
time
.
Duration
(
-
1
*
time
.
Hour
)))
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
{
if
err
!=
nil
{
return
""
return
""
}
}
...
@@ -84,18 +86,19 @@ var _ = Describe("Kubelet", func() {
...
@@ -84,18 +86,19 @@ var _ = Describe("Kubelet", func() {
})
})
It
(
"it should be possible to delete"
,
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
crea
ting Pod %v"
,
err
))
Expect
(
err
)
.
To
(
BeNil
(),
fmt
.
Sprintf
(
"Error
dele
ting Pod %v"
,
err
))
})
})
})
})
Context
(
"when scheduling a read only busybox container"
,
func
()
{
Context
(
"when scheduling a read only busybox container"
,
func
()
{
podName
:=
"busybox-readonly-fs"
It
(
"it should return success"
,
func
()
{
It
(
"it should return success"
,
func
()
{
isReadOnly
:=
true
isReadOnly
:=
true
pod
:=
&
api
.
Pod
{
pod
:=
&
api
.
Pod
{
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"busybox"
,
Name
:
podName
,
Namespace
:
api
.
NamespaceDefault
,
Namespace
:
namespace
,
},
},
Spec
:
api
.
PodSpec
{
Spec
:
api
.
PodSpec
{
// Force the Pod to schedule to the node without a scheduler running
// Force the Pod to schedule to the node without a scheduler running
...
@@ -105,7 +108,7 @@ var _ = Describe("Kubelet", func() {
...
@@ -105,7 +108,7 @@ var _ = Describe("Kubelet", func() {
Containers
:
[]
api
.
Container
{
Containers
:
[]
api
.
Container
{
{
{
Image
:
"gcr.io/google_containers/busybox"
,
Image
:
"gcr.io/google_containers/busybox"
,
Name
:
"busybox"
,
Name
:
podName
,
Command
:
[]
string
{
"sh"
,
"-c"
,
"echo test > /file"
},
Command
:
[]
string
{
"sh"
,
"-c"
,
"echo test > /file"
},
SecurityContext
:
&
api
.
SecurityContext
{
SecurityContext
:
&
api
.
SecurityContext
{
ReadOnlyRootFilesystem
:
&
isReadOnly
,
ReadOnlyRootFilesystem
:
&
isReadOnly
,
...
@@ -114,13 +117,13 @@ var _ = Describe("Kubelet", func() {
...
@@ -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
))
Expect
(
err
)
.
To
(
BeNil
(),
fmt
.
Sprintf
(
"Error creating Pod %v"
,
err
))
})
})
It
(
"it should not write to the root filesystem"
,
func
()
{
It
(
"it should not write to the root filesystem"
,
func
()
{
Eventually
(
func
()
string
{
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
{
if
err
!=
nil
{
return
""
return
""
}
}
...
@@ -132,13 +135,14 @@ var _ = Describe("Kubelet", func() {
...
@@ -132,13 +135,14 @@ var _ = Describe("Kubelet", func() {
})
})
It
(
"it should be possible to delete"
,
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
))
Expect
(
err
)
.
To
(
BeNil
(),
fmt
.
Sprintf
(
"Error creating Pod %v"
,
err
))
})
})
})
})
})
})
Describe
(
"metrics api"
,
func
()
{
Describe
(
"metrics api"
,
func
()
{
namespace
:=
"kubelet-metrics-api"
statsPrefix
:=
"stats-busybox-"
statsPrefix
:=
"stats-busybox-"
podNames
:=
[]
string
{}
podNames
:=
[]
string
{}
podCount
:=
2
podCount
:=
2
...
@@ -147,7 +151,7 @@ var _ = Describe("Kubelet", func() {
...
@@ -147,7 +151,7 @@ var _ = Describe("Kubelet", func() {
}
}
BeforeEach
(
func
()
{
BeforeEach
(
func
()
{
for
_
,
podName
:=
range
podNames
{
for
_
,
podName
:=
range
podNames
{
createPod
(
cl
,
podName
,
[]
api
.
Container
{
createPod
(
cl
,
podName
,
namespace
,
[]
api
.
Container
{
{
{
Image
:
"gcr.io/google_containers/busybox"
,
Image
:
"gcr.io/google_containers/busybox"
,
Command
:
[]
string
{
"sh"
,
"-c"
,
"echo 'Hello World' | tee ~/file | tee /test-empty-dir-mnt | sleep 60"
},
Command
:
[]
string
{
"sh"
,
"-c"
,
"echo 'Hello World' | tee ~/file | tee /test-empty-dir-mnt | sleep 60"
},
...
@@ -259,7 +263,7 @@ var _ = Describe("Kubelet", func() {
...
@@ -259,7 +263,7 @@ var _ = Describe("Kubelet", func() {
AfterEach
(
func
()
{
AfterEach
(
func
()
{
for
_
,
podName
:=
range
podNames
{
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
))
Expect
(
err
)
.
To
(
BeNil
(),
fmt
.
Sprintf
(
"Error deleting Pod %v"
,
podName
))
}
}
})
})
...
@@ -284,11 +288,11 @@ const (
...
@@ -284,11 +288,11 @@ const (
containerSuffix
=
"-c"
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
{
pod
:=
&
api
.
Pod
{
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
podName
,
Name
:
podName
,
Namespace
:
api
.
NamespaceDefault
,
Namespace
:
namespace
,
},
},
Spec
:
api
.
PodSpec
{
Spec
:
api
.
PodSpec
{
// Force the Pod to schedule to the node without a scheduler running
// 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
...
@@ -299,6 +303,6 @@ func createPod(cl *client.Client, podName string, containers []api.Container, vo
Volumes
:
volumes
,
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
))
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