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
9c99da0c
Unverified
Commit
9c99da0c
authored
Sep 13, 2018
by
k8s-ci-robot
Committed by
GitHub
Sep 13, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #68590 from davidz627/fix/VolumeCleanup
Change VolumeTestCleanup to not fail when pod already deleted
parents
4ab85e77
304bb501
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
25 deletions
+16
-25
pv_util.go
test/e2e/framework/pv_util.go
+12
-8
volume_util.go
test/e2e/framework/volume_util.go
+4
-17
No files found.
test/e2e/framework/pv_util.go
View file @
9c99da0c
...
@@ -507,21 +507,25 @@ func testPodSuccessOrFail(c clientset.Interface, ns string, pod *v1.Pod) error {
...
@@ -507,21 +507,25 @@ func testPodSuccessOrFail(c clientset.Interface, ns string, pod *v1.Pod) error {
// Deletes the passed-in pod and waits for the pod to be terminated. Resilient to the pod
// Deletes the passed-in pod and waits for the pod to be terminated. Resilient to the pod
// not existing.
// not existing.
func
DeletePodWithWait
(
f
*
Framework
,
c
clientset
.
Interface
,
pod
*
v1
.
Pod
)
error
{
func
DeletePodWithWait
(
f
*
Framework
,
c
clientset
.
Interface
,
pod
*
v1
.
Pod
)
error
{
if
pod
==
nil
{
return
DeletePodWithWaitByName
(
f
,
c
,
pod
.
GetName
(),
pod
.
GetNamespace
())
return
nil
}
}
Logf
(
"Deleting pod %q in namespace %q"
,
pod
.
Name
,
pod
.
Namespace
)
// Deletes the named and namespaced pod and waits for the pod to be terminated. Resilient to the pod
err
:=
c
.
CoreV1
()
.
Pods
(
pod
.
Namespace
)
.
Delete
(
pod
.
Name
,
nil
)
// not existing.
func
DeletePodWithWaitByName
(
f
*
Framework
,
c
clientset
.
Interface
,
podName
,
podNamespace
string
)
error
{
const
maxWait
=
5
*
time
.
Minute
Logf
(
"Deleting pod %q in namespace %q"
,
podName
,
podNamespace
)
err
:=
c
.
CoreV1
()
.
Pods
(
podNamespace
)
.
Delete
(
podName
,
nil
)
if
err
!=
nil
{
if
err
!=
nil
{
if
apierrs
.
IsNotFound
(
err
)
{
if
apierrs
.
IsNotFound
(
err
)
{
return
nil
// assume pod was already deleted
return
nil
// assume pod was already deleted
}
}
return
fmt
.
Errorf
(
"pod Delete API error: %v"
,
err
)
return
fmt
.
Errorf
(
"pod Delete API error: %v"
,
err
)
}
}
Logf
(
"Wait up to %v for pod %q to be fully deleted"
,
PodDeleteTimeout
,
pod
.
Name
)
Logf
(
"Wait up to %v for pod %q to be fully deleted"
,
maxWait
,
pod
Name
)
err
=
f
.
WaitForPodNotFound
(
pod
.
Name
,
PodDeleteTimeou
t
)
err
=
f
.
WaitForPodNotFound
(
pod
Name
,
maxWai
t
)
if
err
!=
nil
{
if
err
!=
nil
{
return
fmt
.
Errorf
(
"pod %q was not deleted: %v"
,
pod
.
Name
,
err
)
return
fmt
.
Errorf
(
"pod %q was not deleted: %v"
,
podName
,
err
)
}
}
return
nil
return
nil
}
}
...
...
test/e2e/framework/volume_util.go
View file @
9c99da0c
...
@@ -52,7 +52,6 @@ import (
...
@@ -52,7 +52,6 @@ import (
clientset
"k8s.io/client-go/kubernetes"
clientset
"k8s.io/client-go/kubernetes"
imageutils
"k8s.io/kubernetes/test/utils/image"
imageutils
"k8s.io/kubernetes/test/utils/image"
"github.com/golang/glog"
.
"github.com/onsi/ginkgo"
.
"github.com/onsi/ginkgo"
.
"github.com/onsi/gomega"
.
"github.com/onsi/gomega"
)
)
...
@@ -389,24 +388,12 @@ func VolumeTestCleanup(f *Framework, config VolumeTestConfig) {
...
@@ -389,24 +388,12 @@ func VolumeTestCleanup(f *Framework, config VolumeTestConfig) {
cs
:=
f
.
ClientSet
cs
:=
f
.
ClientSet
pod
,
err
:=
cs
.
CoreV1
()
.
Pods
(
config
.
Namespace
)
.
Get
(
config
.
Prefix
+
"-client"
,
metav1
.
GetOptions
{})
err
:=
DeletePodWithWaitByName
(
f
,
cs
,
config
.
Prefix
+
"-client"
,
config
.
Namespace
)
ExpectNoError
(
err
,
"Failed to get client pod: %v"
,
err
)
Expect
(
err
)
.
To
(
BeNil
(),
"Failed to delete pod %v in namespace %v"
,
config
.
Prefix
+
"-client"
,
config
.
Namespace
)
err
=
DeletePodWithWait
(
f
,
cs
,
pod
)
if
err
!=
nil
{
// Log the error before failing test: if the test has already failed,
// framework.ExpectNoError() won't print anything to logs!
glog
.
Warningf
(
"Failed to delete client pod: %v"
,
err
)
ExpectNoError
(
err
,
"Failed to delete client pod: %v"
,
err
)
}
if
config
.
ServerImage
!=
""
{
if
config
.
ServerImage
!=
""
{
pod
,
err
:=
cs
.
CoreV1
()
.
Pods
(
config
.
Namespace
)
.
Get
(
config
.
Prefix
+
"-server"
,
metav1
.
GetOptions
{})
err
:=
DeletePodWithWaitByName
(
f
,
cs
,
config
.
Prefix
+
"-server"
,
config
.
Namespace
)
ExpectNoError
(
err
,
"Failed to get server pod: %v"
,
err
)
Expect
(
err
)
.
To
(
BeNil
(),
"Failed to delete pod %v in namespace %v"
,
config
.
Prefix
+
"-server"
,
config
.
Namespace
)
err
=
DeletePodWithWait
(
f
,
cs
,
pod
)
if
err
!=
nil
{
glog
.
Warningf
(
"Failed to delete server pod: %v"
,
err
)
ExpectNoError
(
err
,
"Failed to delete server 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