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
9a1236ae
Unverified
Commit
9a1236ae
authored
Mar 14, 2017
by
Tim St. Clair
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add process debug information to summary test
parent
f53ba558
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
1 deletion
+44
-1
summary_test.go
test/e2e_node/summary_test.go
+44
-1
No files found.
test/e2e_node/summary_test.go
View file @
9a1236ae
...
@@ -18,6 +18,8 @@ package e2e_node
...
@@ -18,6 +18,8 @@ package e2e_node
import
(
import
(
"fmt"
"fmt"
"io/ioutil"
"strings"
"time"
"time"
"k8s.io/apimachinery/pkg/api/resource"
"k8s.io/apimachinery/pkg/api/resource"
...
@@ -37,9 +39,14 @@ var _ = framework.KubeDescribe("Summary API", func() {
...
@@ -37,9 +39,14 @@ var _ = framework.KubeDescribe("Summary API", func() {
f
:=
framework
.
NewDefaultFramework
(
"summary-test"
)
f
:=
framework
.
NewDefaultFramework
(
"summary-test"
)
Context
(
"when querying /stats/summary"
,
func
()
{
Context
(
"when querying /stats/summary"
,
func
()
{
AfterEach
(
func
()
{
AfterEach
(
func
()
{
if
CurrentGinkgoTestDescription
()
.
Failed
&&
framework
.
TestContext
.
DumpLogsOnFailure
{
if
!
CurrentGinkgoTestDescription
()
.
Failed
{
return
}
if
framework
.
TestContext
.
DumpLogsOnFailure
{
framework
.
LogFailedContainers
(
f
.
ClientSet
,
f
.
Namespace
.
Name
,
framework
.
Logf
)
framework
.
LogFailedContainers
(
f
.
ClientSet
,
f
.
Namespace
.
Name
,
framework
.
Logf
)
}
}
By
(
"Recording processes in system cgroups"
)
recordSystemCgroupProcesses
()
})
})
It
(
"should report resource usage through the stats api"
,
func
()
{
It
(
"should report resource usage through the stats api"
,
func
()
{
const
pod0
=
"stats-busybox-0"
const
pod0
=
"stats-busybox-0"
...
@@ -299,3 +306,39 @@ func recent(d time.Duration) types.GomegaMatcher {
...
@@ -299,3 +306,39 @@ func recent(d time.Duration) types.GomegaMatcher {
// Now() is the test start time, not the match time, so permit a few extra minutes.
// Now() is the test start time, not the match time, so permit a few extra minutes.
BeTemporally
(
"<"
,
time
.
Now
()
.
Add
(
2
*
time
.
Minute
))))
BeTemporally
(
"<"
,
time
.
Now
()
.
Add
(
2
*
time
.
Minute
))))
}
}
func
recordSystemCgroupProcesses
()
{
cfg
,
err
:=
getCurrentKubeletConfig
()
if
err
!=
nil
{
framework
.
Logf
(
"Failed to read kubelet config: %v"
,
err
)
return
}
cgroups
:=
map
[
string
]
string
{
"kubelet"
:
cfg
.
KubeletCgroups
,
"runtime"
:
cfg
.
RuntimeCgroups
,
"misc"
:
cfg
.
SystemCgroups
,
}
for
name
,
cgroup
:=
range
cgroups
{
if
cgroup
==
""
{
framework
.
Logf
(
"Skipping unconfigured cgroup %s"
,
name
)
continue
}
pids
,
err
:=
ioutil
.
ReadFile
(
fmt
.
Sprintf
(
"/sys/fs/cgroup/cpu/%s/cgroup.procs"
,
cgroup
))
if
err
!=
nil
{
framework
.
Logf
(
"Failed to read processes in cgroup %s: %v"
,
name
,
err
)
continue
}
framework
.
Logf
(
"Processes in %s cgroup (%s):"
,
name
,
cgroup
)
for
_
,
pid
:=
range
strings
.
Fields
(
string
(
pids
))
{
path
:=
fmt
.
Sprintf
(
"/proc/%s/cmdline"
,
pid
)
cmd
,
err
:=
ioutil
.
ReadFile
(
path
)
if
err
!=
nil
{
framework
.
Logf
(
" Failed to read %s: %v"
,
path
,
err
)
}
else
{
framework
.
Logf
(
" %s"
,
cmd
)
}
}
}
}
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