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
96119865
Commit
96119865
authored
Jan 08, 2016
by
Minhan Xia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add e2e test for network partition
parent
7f095c1f
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
0 deletions
+38
-0
resize_nodes.go
test/e2e/resize_nodes.go
+0
-0
util.go
test/e2e/util.go
+38
-0
No files found.
test/e2e/resize_nodes.go
View file @
96119865
This diff is collapsed.
Click to expand it.
test/e2e/util.go
View file @
96119865
...
...
@@ -46,6 +46,7 @@ import (
"k8s.io/kubernetes/pkg/cloudprovider"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/kubectl"
"k8s.io/kubernetes/pkg/kubelet/util/format"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util"
...
...
@@ -354,6 +355,16 @@ func podRunningReady(p *api.Pod) (bool, error) {
return
true
,
nil
}
// podNotReady checks whether pod p's has a ready condition of status false.
func
podNotReady
(
p
*
api
.
Pod
)
(
bool
,
error
)
{
// Check the ready condition is false.
if
podReady
(
p
)
{
return
false
,
fmt
.
Errorf
(
"pod '%s' on '%s' didn't have condition {%v %v}; conditions: %v"
,
p
.
ObjectMeta
.
Name
,
p
.
Spec
.
NodeName
,
api
.
PodReady
,
api
.
ConditionFalse
,
p
.
Status
.
Conditions
)
}
return
true
,
nil
}
// check if a Pod is controlled by a Replication Controller in the List
func
hasReplicationControllersForPod
(
rcs
*
api
.
ReplicationControllerList
,
pod
api
.
Pod
)
bool
{
for
_
,
rc
:=
range
rcs
.
Items
{
...
...
@@ -545,6 +556,33 @@ func waitForPodCondition(c *client.Client, ns, podName, desc string, timeout tim
return
fmt
.
Errorf
(
"gave up waiting for pod '%s' to be '%s' after %v"
,
podName
,
desc
,
timeout
)
}
// waitForMatchPodsCondition finds match pods based on the input ListOptions.
// waits and checks if all match pods are in the given podCondition
func
waitForMatchPodsCondition
(
c
*
client
.
Client
,
opts
api
.
ListOptions
,
desc
string
,
timeout
time
.
Duration
,
condition
podCondition
)
error
{
Logf
(
"Waiting up to %v for matching pods' status to be %s"
,
timeout
,
desc
)
for
start
:=
time
.
Now
();
time
.
Since
(
start
)
<
timeout
;
time
.
Sleep
(
poll
)
{
pods
,
err
:=
c
.
Pods
(
api
.
NamespaceAll
)
.
List
(
opts
)
if
err
!=
nil
{
return
err
}
conditionNotMatch
:=
[]
string
{}
for
_
,
pod
:=
range
pods
.
Items
{
done
,
err
:=
condition
(
&
pod
)
if
done
&&
err
!=
nil
{
return
fmt
.
Errorf
(
"Unexpected error: %v"
,
err
)
}
if
!
done
{
conditionNotMatch
=
append
(
conditionNotMatch
,
format
.
Pod
(
&
pod
))
}
}
if
len
(
conditionNotMatch
)
<=
0
{
return
err
}
Logf
(
"%d pods are not %s"
,
len
(
conditionNotMatch
),
desc
)
}
return
fmt
.
Errorf
(
"gave up waiting for matching pods to be '%s' after %v"
,
desc
,
timeout
)
}
// waitForDefaultServiceAccountInNamespace waits for the default service account to be provisioned
// the default service account is what is associated with pods when they do not specify a service account
// as a result, pods are not able to be provisioned in a namespace until the service account is provisioned
...
...
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