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
4e7fed44
Commit
4e7fed44
authored
May 24, 2017
by
Ricky Pai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
e2e node test for PodSpec HostAliases
parent
310ea94b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
0 deletions
+46
-0
kubelet_test.go
test/e2e_node/kubelet_test.go
+46
-0
No files found.
test/e2e_node/kubelet_test.go
View file @
4e7fed44
...
@@ -19,6 +19,7 @@ package e2e_node
...
@@ -19,6 +19,7 @@ package e2e_node
import
(
import
(
"bytes"
"bytes"
"fmt"
"fmt"
"strings"
"time"
"time"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
...
@@ -116,6 +117,51 @@ var _ = framework.KubeDescribe("Kubelet", func() {
...
@@ -116,6 +117,51 @@ var _ = framework.KubeDescribe("Kubelet", func() {
Expect
(
err
)
.
To
(
BeNil
(),
fmt
.
Sprintf
(
"Error deleting Pod %v"
,
err
))
Expect
(
err
)
.
To
(
BeNil
(),
fmt
.
Sprintf
(
"Error deleting Pod %v"
,
err
))
})
})
})
})
Context
(
"when scheduling a busybox Pod with hostAliases"
,
func
()
{
podName
:=
"busybox-host-aliases"
+
string
(
uuid
.
NewUUID
())
It
(
"it should write entries to /etc/hosts"
,
func
()
{
podClient
.
CreateSync
(
&
v1
.
Pod
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
podName
,
},
Spec
:
v1
.
PodSpec
{
// Don't restart the Pod since it is expected to exit
RestartPolicy
:
v1
.
RestartPolicyNever
,
Containers
:
[]
v1
.
Container
{
{
Image
:
"gcr.io/google_containers/busybox:1.24"
,
Name
:
podName
,
Command
:
[]
string
{
"/bin/sh"
,
"-c"
,
"cat /etc/hosts; sleep 6000"
},
},
},
HostAliases
:
[]
v1
.
HostAlias
{
{
IP
:
"123.45.67.89"
,
Hostnames
:
[]
string
{
"foo"
,
"bar"
},
},
},
},
})
Eventually
(
func
()
error
{
rc
,
err
:=
podClient
.
GetLogs
(
podName
,
&
v1
.
PodLogOptions
{})
.
Stream
()
defer
rc
.
Close
()
if
err
!=
nil
{
return
err
}
buf
:=
new
(
bytes
.
Buffer
)
buf
.
ReadFrom
(
rc
)
hostsFileContent
:=
buf
.
String
()
if
!
strings
.
Contains
(
hostsFileContent
,
"123.45.67.89
\t
foo"
)
||
!
strings
.
Contains
(
hostsFileContent
,
"123.45.67.89
\t
bar"
)
{
return
fmt
.
Errorf
(
"expected hosts file to contain entries from HostAliases. Got:
\n
%+v"
,
hostsFileContent
)
}
return
nil
},
time
.
Minute
,
time
.
Second
*
4
)
.
Should
(
BeNil
())
})
})
Context
(
"when scheduling a read only busybox container"
,
func
()
{
Context
(
"when scheduling a read only busybox container"
,
func
()
{
podName
:=
"busybox-readonly-fs"
+
string
(
uuid
.
NewUUID
())
podName
:=
"busybox-readonly-fs"
+
string
(
uuid
.
NewUUID
())
It
(
"it should not write to root filesystem [Conformance]"
,
func
()
{
It
(
"it should not write to root filesystem [Conformance]"
,
func
()
{
...
...
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