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
7f4791c3
Commit
7f4791c3
authored
Apr 08, 2015
by
Daniel Smith
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6582 from bprashanth/rc_integration
Fix a race in the integration tests.
parents
cf97063c
62984f9b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
7 deletions
+14
-7
integration.go
cmd/integration/integration.go
+14
-7
No files found.
cmd/integration/integration.go
View file @
7f4791c3
...
@@ -258,9 +258,15 @@ func makeTempDirOrDie(prefix string, baseDir string) string {
...
@@ -258,9 +258,15 @@ func makeTempDirOrDie(prefix string, baseDir string) string {
}
}
// podsOnMinions returns true when all of the selected pods exist on a minion.
// podsOnMinions returns true when all of the selected pods exist on a minion.
func
podsOnMinions
(
c
*
client
.
Client
,
pod
s
api
.
PodList
)
wait
.
ConditionFunc
{
func
podsOnMinions
(
c
*
client
.
Client
,
pod
Namespace
string
,
labelSelector
labels
.
Selector
)
wait
.
ConditionFunc
{
podInfo
:=
fakeKubeletClient
{}
podInfo
:=
fakeKubeletClient
{}
// wait for minions to indicate they have info about the desired pods
return
func
()
(
bool
,
error
)
{
return
func
()
(
bool
,
error
)
{
pods
,
err
:=
c
.
Pods
(
podNamespace
)
.
List
(
labelSelector
)
if
err
!=
nil
{
glog
.
Infof
(
"Unable to get pods to list: %v"
,
err
)
return
false
,
nil
}
for
i
:=
range
pods
.
Items
{
for
i
:=
range
pods
.
Items
{
host
,
id
,
namespace
:=
pods
.
Items
[
i
]
.
Spec
.
Host
,
pods
.
Items
[
i
]
.
Name
,
pods
.
Items
[
i
]
.
Namespace
host
,
id
,
namespace
:=
pods
.
Items
[
i
]
.
Spec
.
Host
,
pods
.
Items
[
i
]
.
Name
,
pods
.
Items
[
i
]
.
Namespace
glog
.
Infof
(
"Check whether pod %s.%s exists on node %q"
,
id
,
namespace
,
host
)
glog
.
Infof
(
"Check whether pod %s.%s exists on node %q"
,
id
,
namespace
,
host
)
...
@@ -426,12 +432,13 @@ func runReplicationControllerTest(c *client.Client) {
...
@@ -426,12 +432,13 @@ func runReplicationControllerTest(c *client.Client) {
glog
.
Fatalf
(
"FAILED: pods never created %v"
,
err
)
glog
.
Fatalf
(
"FAILED: pods never created %v"
,
err
)
}
}
// wait for minions to indicate they have info about the desired pods
// Poll till we can retrieve the status of all pods matching the given label selector from their minions.
pods
,
err
:=
c
.
Pods
(
"test"
)
.
List
(
labels
.
Set
(
updated
.
Spec
.
Selector
)
.
AsSelector
())
// This involves 3 operations:
if
err
!=
nil
{
// - The scheduler must assign all pods to a minion
glog
.
Fatalf
(
"FAILED: unable to get pods to list: %v"
,
err
)
// - The assignment must reflect in a `List` operation against the apiserver, for labels matching the selector
}
// - We need to be able to query the kubelet on that minion for information about the pod
if
err
:=
wait
.
Poll
(
time
.
Second
,
time
.
Second
*
30
,
podsOnMinions
(
c
,
*
pods
));
err
!=
nil
{
if
err
:=
wait
.
Poll
(
time
.
Second
,
time
.
Second
*
30
,
podsOnMinions
(
c
,
"test"
,
labels
.
Set
(
updated
.
Spec
.
Selector
)
.
AsSelector
()));
err
!=
nil
{
glog
.
Fatalf
(
"FAILED: pods never started running %v"
,
err
)
glog
.
Fatalf
(
"FAILED: pods never started running %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