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
a192edd8
Commit
a192edd8
authored
Feb 24, 2017
by
Jeff Vance
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replace c.Core with c.CoreV1; DeletePodWithWait check
parent
5e6004c7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
14 deletions
+32
-14
pv_util.go
test/e2e/framework/pv_util.go
+24
-6
kubelet.go
test/e2e/kubelet.go
+8
-8
No files found.
test/e2e/framework/pv_util.go
View file @
a192edd8
...
@@ -412,14 +412,32 @@ func DeletePodWithWait(f *Framework, c clientset.Interface, pod *v1.Pod) {
...
@@ -412,14 +412,32 @@ func DeletePodWithWait(f *Framework, c clientset.Interface, pod *v1.Pod) {
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
}
}
// wait for pod to terminate
. Expect apierr NotFound
// wait for pod to terminate
err
=
f
.
WaitForPodTerminated
(
pod
.
Name
,
""
)
err
=
f
.
WaitForPodTerminated
(
pod
.
Name
,
""
)
Expect
(
err
)
.
To
(
HaveOccurred
())
if
err
!=
nil
{
if
!
apierrs
.
IsNotFound
(
err
)
{
Expect
(
apierrs
.
IsNotFound
(
err
))
.
To
(
BeTrue
(),
fmt
.
Sprintf
(
"Expected 'IsNotFound' error deleting pod
\"
%v/%v
\"
, instead got: %v"
,
pod
.
Namespace
,
pod
.
Name
,
err
))
Logf
(
"Error! Expected IsNotFound error deleting pod %q, instead got: %v"
,
pod
.
Name
,
err
)
Logf
(
"Ignore
\"
not found
\"
error above"
)
Expect
(
apierrs
.
IsNotFound
(
err
))
.
To
(
BeTrue
())
}
}
Logf
(
"Ignore
\"
not found
\"
error above. Pod %v successfully deleted"
,
pod
.
Name
)
Logf
(
"Pod %q successfully deleted"
,
pod
.
Name
)
}
// Create the test pod, wait for success, and then delete the pod.
func
CreateWaitAndDeletePod
(
f
*
Framework
,
c
clientset
.
Interface
,
ns
string
,
claimName
string
)
{
Logf
(
"Creating nfs test pod"
)
// Make pod spec
pod
:=
MakeWritePod
(
ns
,
claimName
)
// Instantiate pod (Create)
runPod
,
err
:=
c
.
CoreV1
()
.
Pods
(
ns
)
.
Create
(
pod
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
runPod
)
.
NotTo
(
BeNil
())
defer
DeletePodWithWait
(
f
,
c
,
runPod
)
// Wait for the test pod to complete its lifecycle
testPodSuccessOrFail
(
c
,
ns
,
runPod
)
}
}
// Sanity check for GCE testing. Verify the persistent disk attached to the node.
// Sanity check for GCE testing. Verify the persistent disk attached to the node.
...
...
test/e2e/kubelet.go
View file @
a192edd8
...
@@ -104,7 +104,7 @@ func updateNodeLabels(c clientset.Interface, nodeNames sets.String, toAdd, toRem
...
@@ -104,7 +104,7 @@ func updateNodeLabels(c clientset.Interface, nodeNames sets.String, toAdd, toRem
var
node
*
v1
.
Node
var
node
*
v1
.
Node
var
err
error
var
err
error
for
i
:=
0
;
i
<
maxRetries
;
i
++
{
for
i
:=
0
;
i
<
maxRetries
;
i
++
{
node
,
err
=
c
.
Core
()
.
Nodes
()
.
Get
(
nodeName
,
metav1
.
GetOptions
{})
node
,
err
=
c
.
Core
V1
()
.
Nodes
()
.
Get
(
nodeName
,
metav1
.
GetOptions
{})
if
err
!=
nil
{
if
err
!=
nil
{
framework
.
Logf
(
"Error getting node %s: %v"
,
nodeName
,
err
)
framework
.
Logf
(
"Error getting node %s: %v"
,
nodeName
,
err
)
continue
continue
...
@@ -119,7 +119,7 @@ func updateNodeLabels(c clientset.Interface, nodeNames sets.String, toAdd, toRem
...
@@ -119,7 +119,7 @@ func updateNodeLabels(c clientset.Interface, nodeNames sets.String, toAdd, toRem
delete
(
node
.
ObjectMeta
.
Labels
,
k
)
delete
(
node
.
ObjectMeta
.
Labels
,
k
)
}
}
}
}
_
,
err
=
c
.
Core
()
.
Nodes
()
.
Update
(
node
)
_
,
err
=
c
.
Core
V1
()
.
Nodes
()
.
Update
(
node
)
if
err
!=
nil
{
if
err
!=
nil
{
framework
.
Logf
(
"Error updating node %s: %v"
,
nodeName
,
err
)
framework
.
Logf
(
"Error updating node %s: %v"
,
nodeName
,
err
)
}
else
{
}
else
{
...
@@ -216,13 +216,13 @@ func createPodUsingNfs(f *framework.Framework, c clientset.Interface, ns, nfsIP,
...
@@ -216,13 +216,13 @@ func createPodUsingNfs(f *framework.Framework, c clientset.Interface, ns, nfsIP,
},
},
},
},
}
}
rtnPod
,
err
:=
c
.
Core
()
.
Pods
(
ns
)
.
Create
(
pod
)
rtnPod
,
err
:=
c
.
Core
V1
()
.
Pods
(
ns
)
.
Create
(
pod
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
err
=
f
.
WaitForPodReady
(
rtnPod
.
Name
)
// running & ready
err
=
f
.
WaitForPodReady
(
rtnPod
.
Name
)
// running & ready
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
rtnPod
,
err
=
c
.
Core
()
.
Pods
(
ns
)
.
Get
(
rtnPod
.
Name
,
metav1
.
GetOptions
{})
// return fresh pod
rtnPod
,
err
=
c
.
Core
V1
()
.
Pods
(
ns
)
.
Get
(
rtnPod
.
Name
,
metav1
.
GetOptions
{})
// return fresh pod
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
return
rtnPod
return
rtnPod
...
@@ -443,11 +443,11 @@ var _ = framework.KubeDescribe("kubelet", func() {
...
@@ -443,11 +443,11 @@ var _ = framework.KubeDescribe("kubelet", func() {
// fill in test slice for this context
// fill in test slice for this context
testTbl
:=
[]
hostCleanupTest
{
testTbl
:=
[]
hostCleanupTest
{
{
{
itDescr
:
"after
deleting the nfs-server, the host should be cleaned-up when deleting sleeping pod which mounts an NFS vol
"
,
itDescr
:
"after
stopping the nfs-server and deleting the (sleeping) client pod, the NFS mount and the pod's UID directory should be removed.
"
,
podCmd
:
"sleep 6000"
,
// keep pod running
podCmd
:
"sleep 6000"
,
// keep pod running
},
},
{
{
itDescr
:
"after
deleting the nfs-server, the host should be cleaned-up when deleting a pod accessing the NFS vol
"
,
itDescr
:
"after
stopping the nfs-server and deleting the (active) client pod, the NFS mount and the pod's UID directory should be removed.
"
,
podCmd
:
"while true; do echo FeFieFoFum >>/mnt/SUCCESS; sleep 1; cat /mnt/SUCCESS; done"
,
podCmd
:
"while true; do echo FeFieFoFum >>/mnt/SUCCESS; sleep 1; cat /mnt/SUCCESS; done"
,
},
},
}
}
...
@@ -508,14 +508,14 @@ var _ = framework.KubeDescribe("kubelet", func() {
...
@@ -508,14 +508,14 @@ var _ = framework.KubeDescribe("kubelet", func() {
// Addresses issue #37657.
// Addresses issue #37657.
// Note: the pod's vol mount (as a side effect) ends up being moved to /tmp
// Note: the pod's vol mount (as a side effect) ends up being moved to /tmp
// and can be unmounted via `umount -f`.
// and can be unmounted via `umount -f`.
It
(
"move
pod's uid dir and
delete pod"
,
func
()
{
It
(
"move
NFS client pod's UID directory then
delete pod"
,
func
()
{
pod
=
createPodUsingNfs
(
f
,
c
,
ns
,
nfsIP
,
"sleep 6000"
)
pod
=
createPodUsingNfs
(
f
,
c
,
ns
,
nfsIP
,
"sleep 6000"
)
By
(
"Move pod's uid dir to /tmp"
)
By
(
"Move pod's uid dir to /tmp"
)
movePodUidDir
(
c
,
pod
)
movePodUidDir
(
c
,
pod
)
By
(
"Delete the pod mounted to the NFS volume"
)
By
(
"Delete the pod mounted to the NFS volume"
)
d
eletePodWithWait
(
f
,
c
,
pod
)
framework
.
D
eletePodWithWait
(
f
,
c
,
pod
)
// pod object is now stale, but is intentionally not nil
// pod object is now stale, but is intentionally not nil
// Note: the pod's nfs mount, now in /tmp, will not be unmounted
// Note: the pod's nfs mount, now in /tmp, will not be unmounted
...
...
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