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
e5600f7a
Commit
e5600f7a
authored
Aug 26, 2015
by
Clayton Coleman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dump more pod status when an e2e test fails
parent
f9590a33
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
9 deletions
+13
-9
util.go
test/e2e/util.go
+13
-9
No files found.
test/e2e/util.go
View file @
e5600f7a
...
@@ -259,8 +259,9 @@ func podReady(pod *api.Pod) bool {
...
@@ -259,8 +259,9 @@ func podReady(pod *api.Pod) bool {
// logPodStates logs basic info of provided pods for debugging.
// logPodStates logs basic info of provided pods for debugging.
func
logPodStates
(
pods
[]
api
.
Pod
)
{
func
logPodStates
(
pods
[]
api
.
Pod
)
{
// Find maximum widths for pod, node, and phase strings for column printing.
// Find maximum widths for pod, node, and phase strings for column printing.
maxPodW
,
maxNodeW
,
maxPhaseW
:=
len
(
"POD"
),
len
(
"NODE"
),
len
(
"PHASE"
)
maxPodW
,
maxNodeW
,
maxPhaseW
,
maxGraceW
:=
len
(
"POD"
),
len
(
"NODE"
),
len
(
"PHASE"
),
len
(
"GRACE"
)
for
_
,
pod
:=
range
pods
{
for
i
:=
range
pods
{
pod
:=
&
pods
[
i
]
if
len
(
pod
.
ObjectMeta
.
Name
)
>
maxPodW
{
if
len
(
pod
.
ObjectMeta
.
Name
)
>
maxPodW
{
maxPodW
=
len
(
pod
.
ObjectMeta
.
Name
)
maxPodW
=
len
(
pod
.
ObjectMeta
.
Name
)
}
}
...
@@ -275,13 +276,18 @@ func logPodStates(pods []api.Pod) {
...
@@ -275,13 +276,18 @@ func logPodStates(pods []api.Pod) {
maxPodW
++
maxPodW
++
maxNodeW
++
maxNodeW
++
maxPhaseW
++
maxPhaseW
++
maxGraceW
++
// Log pod info. * does space padding, - makes them left-aligned.
// Log pod info. * does space padding, - makes them left-aligned.
Logf
(
"%-[1]*[2]s %-[3]*[4]s %-[5]*[6]s %
[7
]s"
,
Logf
(
"%-[1]*[2]s %-[3]*[4]s %-[5]*[6]s %
-[7]*[8]s %[9
]s"
,
maxPodW
,
"POD"
,
maxNodeW
,
"NODE"
,
maxPhaseW
,
"PHASE"
,
"CONDITIONS"
)
maxPodW
,
"POD"
,
maxNodeW
,
"NODE"
,
maxPhaseW
,
"PHASE"
,
maxGraceW
,
"GRACE"
,
"CONDITIONS"
)
for
_
,
pod
:=
range
pods
{
for
_
,
pod
:=
range
pods
{
Logf
(
"%-[1]*[2]s %-[3]*[4]s %-[5]*[6]s %[7]s"
,
grace
:=
""
maxPodW
,
pod
.
ObjectMeta
.
Name
,
maxNodeW
,
pod
.
Spec
.
NodeName
,
maxPhaseW
,
pod
.
Status
.
Phase
,
pod
.
Status
.
Conditions
)
if
pod
.
DeletionGracePeriodSeconds
!=
nil
{
grace
=
fmt
.
Sprintf
(
"%ds"
,
*
pod
.
DeletionGracePeriodSeconds
)
}
Logf
(
"%-[1]*[2]s %-[3]*[4]s %-[5]*[6]s %[7]s %[8]s"
,
maxPodW
,
pod
.
ObjectMeta
.
Name
,
maxNodeW
,
pod
.
Spec
.
NodeName
,
maxPhaseW
,
pod
.
Status
.
Phase
,
grace
,
pod
.
Status
.
Conditions
)
}
}
Logf
(
""
)
// Final empty line helps for readability.
Logf
(
""
)
// Final empty line helps for readability.
}
}
...
@@ -1350,9 +1356,7 @@ func dumpAllPodInfo(c *client.Client) {
...
@@ -1350,9 +1356,7 @@ func dumpAllPodInfo(c *client.Client) {
if
err
!=
nil
{
if
err
!=
nil
{
Logf
(
"unable to fetch pod debug info: %v"
,
err
)
Logf
(
"unable to fetch pod debug info: %v"
,
err
)
}
}
for
_
,
pod
:=
range
pods
.
Items
{
logPodStates
(
pods
.
Items
)
Logf
(
"Pod %s %s node=%s, deletionTimestamp=%s"
,
pod
.
Namespace
,
pod
.
Name
,
pod
.
Spec
.
NodeName
,
pod
.
DeletionTimestamp
)
}
}
}
func
dumpNodeDebugInfo
(
c
*
client
.
Client
,
nodeNames
[]
string
)
{
func
dumpNodeDebugInfo
(
c
*
client
.
Client
,
nodeNames
[]
string
)
{
...
...
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