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
130437b9
Commit
130437b9
authored
Mar 09, 2017
by
Chao Xu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wait for the deletionTimestamp set instead of waiting for the final deletion
parent
d6ae61c3
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
14 deletions
+30
-14
generated_clientset.go
test/e2e/generated_clientset.go
+30
-14
No files found.
test/e2e/generated_clientset.go
View file @
130437b9
...
@@ -120,9 +120,31 @@ func observeObjectDeletion(w watch.Interface) (obj runtime.Object) {
...
@@ -120,9 +120,31 @@ func observeObjectDeletion(w watch.Interface) (obj runtime.Object) {
return
return
}
}
func
observerUpdate
(
w
watch
.
Interface
,
expectedUpdate
func
(
runtime
.
Object
)
bool
)
{
timer
:=
time
.
After
(
30
*
time
.
Second
)
updated
:=
false
timeout
:=
false
for
!
updated
&&
!
timeout
{
select
{
case
event
,
_
:=
<-
w
.
ResultChan
()
:
if
event
.
Type
==
watch
.
Modified
{
if
expectedUpdate
(
event
.
Object
)
{
updated
=
true
}
}
case
<-
timer
:
timeout
=
true
}
}
if
!
updated
{
framework
.
Failf
(
"Failed to observe pod update"
)
}
return
}
var
_
=
framework
.
KubeDescribe
(
"Generated release_1_5 clientset"
,
func
()
{
var
_
=
framework
.
KubeDescribe
(
"Generated release_1_5 clientset"
,
func
()
{
f
:=
framework
.
NewDefaultFramework
(
"clientset"
)
f
:=
framework
.
NewDefaultFramework
(
"clientset"
)
It
(
"should create pods,
delete pods, watch pods
"
,
func
()
{
It
(
"should create pods,
set the deletionTimestamp and deletionGracePeriodSeconds of the pod
"
,
func
()
{
podClient
:=
f
.
ClientSet
.
Core
()
.
Pods
(
f
.
Namespace
.
Name
)
podClient
:=
f
.
ClientSet
.
Core
()
.
Pods
(
f
.
Namespace
.
Name
)
By
(
"constructing the pod"
)
By
(
"constructing the pod"
)
name
:=
"pod"
+
string
(
uuid
.
NewUUID
())
name
:=
"pod"
+
string
(
uuid
.
NewUUID
())
...
@@ -171,22 +193,16 @@ var _ = framework.KubeDescribe("Generated release_1_5 clientset", func() {
...
@@ -171,22 +193,16 @@ var _ = framework.KubeDescribe("Generated release_1_5 clientset", func() {
framework
.
ExpectNoError
(
f
.
WaitForPodRunning
(
pod
.
Name
))
framework
.
ExpectNoError
(
f
.
WaitForPodRunning
(
pod
.
Name
))
By
(
"deleting the pod gracefully"
)
By
(
"deleting the pod gracefully"
)
if
err
:=
podClient
.
Delete
(
pod
.
Name
,
metav1
.
NewDeleteOptions
(
30
));
err
!=
nil
{
gracePeriod
:=
int64
(
31
)
if
err
:=
podClient
.
Delete
(
pod
.
Name
,
metav1
.
NewDeleteOptions
(
gracePeriod
));
err
!=
nil
{
framework
.
Failf
(
"Failed to delete pod: %v"
,
err
)
framework
.
Failf
(
"Failed to delete pod: %v"
,
err
)
}
}
By
(
"verifying pod deletion was observed"
)
By
(
"verifying the deletionTimestamp and deletionGracePeriodSeconds of the pod is set"
)
obj
:=
observeObjectDeletion
(
w
)
observerUpdate
(
w
,
func
(
obj
runtime
.
Object
)
bool
{
lastPod
:=
obj
.
(
*
v1
.
Pod
)
pod
:=
obj
.
(
*
v1
.
Pod
)
Expect
(
lastPod
.
DeletionTimestamp
)
.
ToNot
(
BeNil
())
return
pod
.
ObjectMeta
.
DeletionTimestamp
!=
nil
&&
*
pod
.
ObjectMeta
.
DeletionGracePeriodSeconds
==
gracePeriod
Expect
(
lastPod
.
Spec
.
TerminationGracePeriodSeconds
)
.
ToNot
(
BeZero
())
})
options
=
metav1
.
ListOptions
{
LabelSelector
:
selector
}
pods
,
err
=
podClient
.
List
(
options
)
if
err
!=
nil
{
framework
.
Failf
(
"Failed to list pods to verify deletion: %v"
,
err
)
}
Expect
(
len
(
pods
.
Items
))
.
To
(
Equal
(
0
))
})
})
})
})
...
...
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