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
519b5748
Commit
519b5748
authored
Jul 18, 2016
by
Chao Xu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wait for the podInformer to observe the pod creation in the rc's TestAdoption test
parent
6d09ba41
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
1 deletion
+19
-1
replicationcontroller_test.go
test/integration/replicationcontroller_test.go
+19
-1
No files found.
test/integration/replicationcontroller_test.go
View file @
519b5748
...
@@ -216,7 +216,8 @@ func TestAdoption(t *testing.T) {
...
@@ -216,7 +216,8 @@ func TestAdoption(t *testing.T) {
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatalf
(
"Failed to create replication controller: %v"
,
err
)
t
.
Fatalf
(
"Failed to create replication controller: %v"
,
err
)
}
}
pod
:=
newMatchingPod
(
"pod1"
,
ns
.
Name
)
podName
:=
fmt
.
Sprintf
(
"pod%d"
,
i
)
pod
:=
newMatchingPod
(
podName
,
ns
.
Name
)
pod
.
OwnerReferences
=
tc
.
existingOwnerReferences
(
rc
)
pod
.
OwnerReferences
=
tc
.
existingOwnerReferences
(
rc
)
_
,
err
=
podClient
.
Create
(
pod
)
_
,
err
=
podClient
.
Create
(
pod
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -225,6 +226,23 @@ func TestAdoption(t *testing.T) {
...
@@ -225,6 +226,23 @@ func TestAdoption(t *testing.T) {
stopCh
:=
make
(
chan
struct
{})
stopCh
:=
make
(
chan
struct
{})
go
podInformer
.
Run
(
stopCh
)
go
podInformer
.
Run
(
stopCh
)
// wait for the podInformer to observe the pod, otherwise the rc manager
// will try to create a new pod rather than adopting the existing one.
if
err
:=
wait
.
Poll
(
10
*
time
.
Second
,
60
*
time
.
Second
,
func
()
(
bool
,
error
)
{
objects
:=
podInformer
.
GetIndexer
()
.
List
()
for
_
,
object
:=
range
objects
{
pod
,
ok
:=
object
.
(
*
api
.
Pod
)
if
!
ok
{
t
.
Fatal
(
"expect object to be a pod"
)
}
if
pod
.
Name
==
podName
{
return
true
,
nil
}
}
return
false
,
nil
});
err
!=
nil
{
t
.
Fatal
(
err
)
}
go
rm
.
Run
(
5
,
stopCh
)
go
rm
.
Run
(
5
,
stopCh
)
if
err
:=
wait
.
Poll
(
10
*
time
.
Second
,
60
*
time
.
Second
,
func
()
(
bool
,
error
)
{
if
err
:=
wait
.
Poll
(
10
*
time
.
Second
,
60
*
time
.
Second
,
func
()
(
bool
,
error
)
{
updatedPod
,
err
:=
podClient
.
Get
(
pod
.
Name
)
updatedPod
,
err
:=
podClient
.
Get
(
pod
.
Name
)
...
...
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