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
2bb0fc00
Commit
2bb0fc00
authored
Jun 08, 2015
by
krousey
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #9392 from jszczepkowski/e2e-net
Added e2e test case for network partition.
parents
ab1bc9fd
445ae0f5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
0 deletions
+49
-0
resize_nodes.go
test/e2e/resize_nodes.go
+0
-0
util.go
test/e2e/util.go
+49
-0
No files found.
test/e2e/resize_nodes.go
View file @
2bb0fc00
This diff is collapsed.
Click to expand it.
test/e2e/util.go
View file @
2bb0fc00
...
...
@@ -42,6 +42,7 @@ import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util/wait"
"github.com/GoogleCloudPlatform/kubernetes/pkg/watch"
"code.google.com/p/go-uuid/uuid"
...
...
@@ -397,6 +398,54 @@ func waitForPodSuccess(c *client.Client, podName string, contName string) error
return
waitForPodSuccessInNamespace
(
c
,
podName
,
contName
,
api
.
NamespaceDefault
)
}
// waitForRCPodOnNode returns the pod from the given replication controller (decribed by rcName) which is scheduled on the given node.
// In case of failure or too long waiting time, an error is returned.
func
waitForRCPodOnNode
(
c
*
client
.
Client
,
ns
,
rcName
,
node
string
)
(
*
api
.
Pod
,
error
)
{
label
:=
labels
.
SelectorFromSet
(
labels
.
Set
(
map
[
string
]
string
{
"name"
:
rcName
}))
var
p
*
api
.
Pod
=
nil
err
:=
wait
.
Poll
(
10
*
time
.
Second
,
5
*
time
.
Minute
,
func
()
(
bool
,
error
)
{
Logf
(
"Waiting for pod %s to appear on node %s"
,
rcName
,
node
)
pods
,
err
:=
c
.
Pods
(
ns
)
.
List
(
label
,
fields
.
Everything
())
if
err
!=
nil
{
return
false
,
err
}
for
_
,
pod
:=
range
pods
.
Items
{
if
pod
.
Spec
.
NodeName
==
node
{
Logf
(
"Pod %s found on node %s"
,
pod
.
Name
,
node
)
p
=
&
pod
return
true
,
nil
}
}
return
false
,
nil
})
return
p
,
err
}
// waitForRCPodOnNode returns nil if the pod from the given replication controller (decribed by rcName) no longer exists.
// In case of failure or too long waiting time, an error is returned.
func
waitForRCPodToDisappear
(
c
*
client
.
Client
,
ns
,
rcName
,
podName
string
)
error
{
label
:=
labels
.
SelectorFromSet
(
labels
.
Set
(
map
[
string
]
string
{
"name"
:
rcName
}))
return
wait
.
Poll
(
20
*
time
.
Second
,
5
*
time
.
Minute
,
func
()
(
bool
,
error
)
{
Logf
(
"Waiting for pod %s to disappear"
,
podName
)
pods
,
err
:=
c
.
Pods
(
ns
)
.
List
(
label
,
fields
.
Everything
())
if
err
!=
nil
{
return
false
,
err
}
found
:=
false
for
_
,
pod
:=
range
pods
.
Items
{
if
pod
.
Name
==
podName
{
Logf
(
"Pod %s still exists"
,
podName
)
found
=
true
}
}
if
!
found
{
Logf
(
"Pod %s no longer exists"
,
podName
)
return
true
,
nil
}
return
false
,
nil
})
}
// Context for checking pods responses by issuing GETs to them and verifying if the answer with pod name.
type
podResponseChecker
struct
{
c
*
client
.
Client
...
...
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