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
a51ba71a
Commit
a51ba71a
authored
Sep 29, 2015
by
Tim Hockin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make Service e2e run a bit faster
parent
0aa5c16f
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
21 deletions
+14
-21
prompush.go
test/e2e/prompush.go
+0
-2
service.go
test/e2e/service.go
+0
-0
util.go
test/e2e/util.go
+14
-19
No files found.
test/e2e/prompush.go
View file @
a51ba71a
...
...
@@ -39,9 +39,7 @@ var prom_registered = false
// Reusable function for pushing metrics to prometheus. Handles initialization and so on.
func
promPushRunningPending
(
running
,
pending
int
)
error
{
if
testContext
.
PrometheusPushGateway
==
""
{
Logf
(
"Ignoring prom push, push gateway unavailable"
)
return
nil
}
else
{
// Register metrics if necessary
...
...
test/e2e/service.go
View file @
a51ba71a
This diff is collapsed.
Click to expand it.
test/e2e/util.go
View file @
a51ba71a
...
...
@@ -86,10 +86,6 @@ const (
podRespondingTimeout
=
2
*
time
.
Minute
serviceRespondingTimeout
=
2
*
time
.
Minute
endpointRegisterTimeout
=
time
.
Minute
// How wide to print pod names, by default. Useful for aligning printing to
// quickly scan through output.
podPrintWidth
=
55
)
type
CloudConfig
struct
{
...
...
@@ -411,22 +407,22 @@ func waitForServiceAccountInNamespace(c *client.Client, ns, serviceAccountName s
}
func
waitForPodCondition
(
c
*
client
.
Client
,
ns
,
podName
,
desc
string
,
timeout
time
.
Duration
,
condition
podCondition
)
error
{
Logf
(
"Waiting up to %[1]v for pod %
-[2]*[3]s status to be %[4]s"
,
timeout
,
podPrintWidth
,
podName
,
desc
)
Logf
(
"Waiting up to %[1]v for pod %
[2]s status to be %[3]s"
,
timeout
,
podName
,
desc
)
for
start
:=
time
.
Now
();
time
.
Since
(
start
)
<
timeout
;
time
.
Sleep
(
poll
)
{
pod
,
err
:=
c
.
Pods
(
ns
)
.
Get
(
podName
)
if
err
!=
nil
{
// Aligning this text makes it much more readable
Logf
(
"Get pod %
-[1]*[2]s in namespace '%[3]s' failed, ignoring for %[4]v. Error: %[5
]v"
,
pod
PrintWidth
,
pod
Name
,
ns
,
poll
,
err
)
Logf
(
"Get pod %
[1]s in namespace '%[2]s' failed, ignoring for %[3]v. Error: %[4
]v"
,
podName
,
ns
,
poll
,
err
)
continue
}
done
,
err
:=
condition
(
pod
)
if
done
{
return
err
}
Logf
(
"Waiting for pod %
-[1]*[2]s in namespace '%[3]s' status to be '%[4
]s'"
+
"(found phase: %[
5]q, readiness: %[6]t) (%[7
]v elapsed)"
,
pod
PrintWidth
,
pod
Name
,
ns
,
desc
,
pod
.
Status
.
Phase
,
podReady
(
pod
),
time
.
Since
(
start
))
Logf
(
"Waiting for pod %
[1]s in namespace '%[2]s' status to be '%[3
]s'"
+
"(found phase: %[
4]q, readiness: %[5]t) (%[6
]v elapsed)"
,
podName
,
ns
,
desc
,
pod
.
Status
.
Phase
,
podReady
(
pod
),
time
.
Since
(
start
))
}
return
fmt
.
Errorf
(
"gave up waiting for pod '%s' to be '%s' after %v"
,
podName
,
desc
,
timeout
)
}
...
...
@@ -1214,7 +1210,6 @@ func Diff(oldPods []*api.Pod, curPods []*api.Pod) PodDiff {
// It's the caller's responsibility to clean up externally (i.e. use the
// namespace lifecycle for handling cleanup).
func
RunRC
(
config
RCConfig
)
error
{
// Don't force tests to fail if they don't care about containers restarting.
var
maxContainerFailures
int
if
config
.
MaxContainerFailures
==
nil
{
...
...
@@ -1225,7 +1220,7 @@ func RunRC(config RCConfig) error {
label
:=
labels
.
SelectorFromSet
(
labels
.
Set
(
map
[
string
]
string
{
"name"
:
config
.
Name
}))
By
(
fmt
.
Sprintf
(
"
%v Creating replication controller %s"
,
time
.
Now
(),
config
.
Nam
e
))
By
(
fmt
.
Sprintf
(
"
creating replication controller %s in namespace %s"
,
config
.
Name
,
config
.
Namespac
e
))
rc
:=
&
api
.
ReplicationController
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
config
.
Name
,
...
...
@@ -1292,7 +1287,7 @@ func RunRC(config RCConfig) error {
if
err
!=
nil
{
return
fmt
.
Errorf
(
"Error creating replication controller: %v"
,
err
)
}
Logf
(
"
%v Created replication controller with name: %v, namespace: %v, replica count: %v"
,
time
.
Now
()
,
rc
.
Name
,
config
.
Namespace
,
rc
.
Spec
.
Replicas
)
Logf
(
"
Created replication controller with name: %v, namespace: %v, replica count: %v"
,
rc
.
Name
,
config
.
Namespace
,
rc
.
Spec
.
Replicas
)
podStore
:=
newPodStore
(
config
.
Client
,
config
.
Namespace
,
label
,
fields
.
Everything
())
defer
podStore
.
Stop
()
...
...
@@ -1364,13 +1359,13 @@ func RunRC(config RCConfig) error {
*
config
.
CreatedPods
=
pods
}
Logf
(
"%v
%v
Pods: %d out of %d created, %d running, %d pending, %d waiting, %d inactive, %d terminating, %d unknown, %d runningButNotReady "
,
time
.
Now
(),
rc
.
Name
,
len
(
pods
),
config
.
Replicas
,
running
,
pending
,
waiting
,
inactive
,
terminating
,
unknown
,
runningButNotReady
)
Logf
(
"%v Pods: %d out of %d created, %d running, %d pending, %d waiting, %d inactive, %d terminating, %d unknown, %d runningButNotReady "
,
rc
.
Name
,
len
(
pods
),
config
.
Replicas
,
running
,
pending
,
waiting
,
inactive
,
terminating
,
unknown
,
runningButNotReady
)
promPushRunningPending
(
running
,
pending
)
if
config
.
PodStatusFile
!=
nil
{
fmt
.
Fprintf
(
config
.
PodStatusFile
,
"%
s, %d, running, %d, pending, %d, waiting, %d, inactive, %d, unknown, %d, runningButNotReady
\n
"
,
time
.
Now
()
,
running
,
pending
,
waiting
,
inactive
,
unknown
,
runningButNotReady
)
fmt
.
Fprintf
(
config
.
PodStatusFile
,
"%
d, running, %d, pending, %d, waiting, %d, inactive, %d, unknown, %d, runningButNotReady
\n
"
,
running
,
pending
,
waiting
,
inactive
,
unknown
,
runningButNotReady
)
}
if
failedContainers
>
maxContainerFailures
{
...
...
@@ -1482,7 +1477,7 @@ func getNodeEvents(c *client.Client, nodeName string) []api.Event {
}
func
ScaleRC
(
c
*
client
.
Client
,
ns
,
name
string
,
size
uint
,
wait
bool
)
error
{
By
(
fmt
.
Sprintf
(
"
%v Scaling replication controller %s in namespace %s to %d"
,
time
.
Now
()
,
name
,
ns
,
size
))
By
(
fmt
.
Sprintf
(
"
Scaling replication controller %s in namespace %s to %d"
,
name
,
ns
,
size
))
scaler
,
err
:=
kubectl
.
ScalerFor
(
"ReplicationController"
,
c
)
if
err
!=
nil
{
return
err
...
...
@@ -1538,7 +1533,7 @@ func waitForPodsWithLabel(c *client.Client, ns string, label labels.Selector) (p
// Delete a Replication Controller and all pods it spawned
func
DeleteRC
(
c
*
client
.
Client
,
ns
,
name
string
)
error
{
By
(
fmt
.
Sprintf
(
"
%v Deleting replication controller %s in namespace %s"
,
time
.
Now
()
,
name
,
ns
))
By
(
fmt
.
Sprintf
(
"
deleting replication controller %s in namespace %s"
,
name
,
ns
))
rc
,
err
:=
c
.
ReplicationControllers
(
ns
)
.
Get
(
name
)
if
err
!=
nil
{
if
apierrs
.
IsNotFound
(
err
)
{
...
...
@@ -1815,7 +1810,7 @@ func checkPodsRunningReady(c *client.Client, ns string, podNames []string, timeo
// support only Go >= 1.4.
for
_
,
podName
:=
range
podNames
{
if
!<-
result
{
Logf
(
"Pod %
-[1]*[2]s failed to be %[3]s."
,
podPrintWidth
,
podName
,
desc
)
Logf
(
"Pod %
[1]s failed to be %[2]s."
,
podName
,
desc
)
success
=
false
}
}
...
...
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