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
be987ac2
Commit
be987ac2
authored
Apr 19, 2017
by
gmarek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow summaries to be printed out to ReportDir instead of stdout
parent
712ccf3f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
4 deletions
+35
-4
framework.go
test/e2e/framework/framework.go
+23
-4
log_size_monitoring.go
test/e2e/framework/log_size_monitoring.go
+4
-0
metrics_util.go
test/e2e/framework/metrics_util.go
+4
-0
resource_usage_gatherer.go
test/e2e/framework/resource_usage_gatherer.go
+4
-0
No files found.
test/e2e/framework/framework.go
View file @
be987ac2
...
@@ -20,6 +20,8 @@ import (
...
@@ -20,6 +20,8 @@ import (
"bytes"
"bytes"
"encoding/json"
"encoding/json"
"fmt"
"fmt"
"io/ioutil"
"path"
"reflect"
"reflect"
"strings"
"strings"
"sync"
"sync"
...
@@ -89,6 +91,7 @@ type Framework struct {
...
@@ -89,6 +91,7 @@ type Framework struct {
}
}
type
TestDataSummary
interface
{
type
TestDataSummary
interface
{
SummaryKind
()
string
PrintHumanReadable
()
string
PrintHumanReadable
()
string
PrintJSON
()
string
PrintJSON
()
string
}
}
...
@@ -317,17 +320,33 @@ func (f *Framework) AfterEach() {
...
@@ -317,17 +320,33 @@ func (f *Framework) AfterEach() {
}
}
outputTypes
:=
strings
.
Split
(
TestContext
.
OutputPrintType
,
","
)
outputTypes
:=
strings
.
Split
(
TestContext
.
OutputPrintType
,
","
)
now
:=
time
.
Now
()
for
_
,
printType
:=
range
outputTypes
{
for
_
,
printType
:=
range
outputTypes
{
switch
printType
{
switch
printType
{
case
"hr"
:
case
"hr"
:
for
i
:=
range
summaries
{
for
i
:=
range
summaries
{
Logf
(
summaries
[
i
]
.
PrintHumanReadable
())
if
TestContext
.
ReportDir
==
""
{
Logf
(
summaries
[
i
]
.
PrintHumanReadable
())
}
else
{
// TODO: learn to extract test name and append it to the kind instead of timestamp.
filePath
:=
path
.
Join
(
TestContext
.
ReportDir
,
summaries
[
i
]
.
SummaryKind
()
+
now
.
Format
(
time
.
RFC3339
)
+
".txt"
)
if
err
:=
ioutil
.
WriteFile
(
filePath
,
[]
byte
(
summaries
[
i
]
.
PrintHumanReadable
()),
0644
);
err
!=
nil
{
Logf
(
"Failed to write file %v with test performance data: %v"
,
filePath
,
err
)
}
}
}
}
case
"json"
:
case
"json"
:
for
i
:=
range
summaries
{
for
i
:=
range
summaries
{
typeName
:=
reflect
.
TypeOf
(
summaries
[
i
])
.
String
()
if
TestContext
.
ReportDir
==
""
{
Logf
(
"%v JSON
\n
%v"
,
typeName
[
strings
.
LastIndex
(
typeName
,
"."
)
+
1
:
],
summaries
[
i
]
.
PrintJSON
())
Logf
(
"%v JSON
\n
%v"
,
summaries
[
i
]
.
SummaryKind
(),
summaries
[
i
]
.
PrintJSON
())
Logf
(
"Finished"
)
Logf
(
"Finished"
)
}
else
{
// TODO: learn to extract test name and append it to the kind instead of timestamp.
filePath
:=
path
.
Join
(
TestContext
.
ReportDir
,
summaries
[
i
]
.
SummaryKind
()
+
now
.
Format
(
time
.
RFC3339
)
+
".json"
)
if
err
:=
ioutil
.
WriteFile
(
filePath
,
[]
byte
(
summaries
[
i
]
.
PrintJSON
()),
0644
);
err
!=
nil
{
Logf
(
"Failed to write file %v with test performance data: %v"
,
filePath
,
err
)
}
}
}
}
default
:
default
:
Logf
(
"Unknown output type: %v. Skipping."
,
printType
)
Logf
(
"Unknown output type: %v. Skipping."
,
printType
)
...
...
test/e2e/framework/log_size_monitoring.go
View file @
be987ac2
...
@@ -104,6 +104,10 @@ func (s *LogsSizeDataSummary) PrintJSON() string {
...
@@ -104,6 +104,10 @@ func (s *LogsSizeDataSummary) PrintJSON() string {
return
PrettyPrintJSON
(
*
s
)
return
PrettyPrintJSON
(
*
s
)
}
}
func
(
s
*
LogsSizeDataSummary
)
SummaryKind
()
string
{
return
"LogSizeSummary"
}
type
LogsSizeData
struct
{
type
LogsSizeData
struct
{
data
LogSizeDataTimeseries
data
LogSizeDataTimeseries
lock
sync
.
Mutex
lock
sync
.
Mutex
...
...
test/e2e/framework/metrics_util.go
View file @
be987ac2
...
@@ -105,6 +105,10 @@ func (m *MetricsForE2E) PrintJSON() string {
...
@@ -105,6 +105,10 @@ func (m *MetricsForE2E) PrintJSON() string {
return
PrettyPrintJSON
(
*
m
)
return
PrettyPrintJSON
(
*
m
)
}
}
func
(
m
*
MetricsForE2E
)
SummaryKind
()
string
{
return
"MetricsForE2E"
}
var
InterestingApiServerMetrics
=
[]
string
{
var
InterestingApiServerMetrics
=
[]
string
{
"apiserver_request_count"
,
"apiserver_request_count"
,
"apiserver_request_latencies_summary"
,
"apiserver_request_latencies_summary"
,
...
...
test/e2e/framework/resource_usage_gatherer.go
View file @
be987ac2
...
@@ -70,6 +70,10 @@ func (s *ResourceUsageSummary) PrintJSON() string {
...
@@ -70,6 +70,10 @@ func (s *ResourceUsageSummary) PrintJSON() string {
return
PrettyPrintJSON
(
*
s
)
return
PrettyPrintJSON
(
*
s
)
}
}
func
(
s
*
ResourceUsageSummary
)
SummaryKind
()
string
{
return
"ResourceUsageSummary"
}
func
computePercentiles
(
timeSeries
[]
ResourceUsagePerContainer
,
percentilesToCompute
[]
int
)
map
[
int
]
ResourceUsagePerContainer
{
func
computePercentiles
(
timeSeries
[]
ResourceUsagePerContainer
,
percentilesToCompute
[]
int
)
map
[
int
]
ResourceUsagePerContainer
{
if
len
(
timeSeries
)
==
0
{
if
len
(
timeSeries
)
==
0
{
return
make
(
map
[
int
]
ResourceUsagePerContainer
)
return
make
(
map
[
int
]
ResourceUsagePerContainer
)
...
...
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