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
e88fdb85
Commit
e88fdb85
authored
Apr 14, 2016
by
Phillip Wittrock
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only output log files if tests fail
parent
af1e1c3c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
8 deletions
+35
-8
e2e_node_suite_test.go
test/e2e_node/e2e_node_suite_test.go
+35
-8
No files found.
test/e2e_node/e2e_node_suite_test.go
View file @
e88fdb85
...
...
@@ -30,6 +30,8 @@ import (
"github.com/golang/glog"
.
"github.com/onsi/ginkgo"
"github.com/onsi/ginkgo/config"
"github.com/onsi/ginkgo/types"
.
"github.com/onsi/gomega"
)
...
...
@@ -46,7 +48,8 @@ func TestE2eNode(t *testing.T) {
flag
.
Parse
()
rand
.
Seed
(
time
.
Now
()
.
UTC
()
.
UnixNano
())
RegisterFailHandler
(
Fail
)
RunSpecs
(
t
,
"E2eNode Suite"
)
reporters
:=
[]
Reporter
{
&
LogReporter
{}}
RunSpecsWithDefaultAndCustomReporters
(
t
,
"E2eNode Suite"
,
reporters
)
}
// Setup the kubelet on the node
...
...
@@ -78,15 +81,39 @@ var _ = AfterSuite(func() {
if
e2es
!=
nil
&&
*
startServices
&&
*
stopServices
{
glog
.
Infof
(
"Stopping node services..."
)
e2es
.
stop
()
b
:=
&
bytes
.
Buffer
{}
}
})
var
_
Reporter
=
&
LogReporter
{}
type
LogReporter
struct
{}
func
(
lr
*
LogReporter
)
SpecSuiteWillBegin
(
config
config
.
GinkgoConfigType
,
summary
*
types
.
SuiteSummary
)
{
b
:=
&
bytes
.
Buffer
{}
b
.
WriteString
(
"******************************************************
\n
"
)
glog
.
V
(
2
)
.
Infof
(
b
.
String
())
}
func
(
lr
*
LogReporter
)
BeforeSuiteDidRun
(
setupSummary
*
types
.
SetupSummary
)
{}
func
(
lr
*
LogReporter
)
SpecWillRun
(
specSummary
*
types
.
SpecSummary
)
{}
func
(
lr
*
LogReporter
)
SpecDidComplete
(
specSummary
*
types
.
SpecSummary
)
{}
func
(
lr
*
LogReporter
)
AfterSuiteDidRun
(
setupSummary
*
types
.
SetupSummary
)
{}
func
(
lr
*
LogReporter
)
SpecSuiteDidEnd
(
summary
*
types
.
SuiteSummary
)
{
// Only log the binary output if the suite failed.
b
:=
&
bytes
.
Buffer
{}
if
e2es
!=
nil
&&
!
summary
.
SuiteSucceeded
{
b
.
WriteString
(
fmt
.
Sprintf
(
"Process Log For Failed Suite On %s
\n
"
,
*
nodeName
))
b
.
WriteString
(
"-------------------------------------------------------------
\n
"
)
b
.
WriteString
(
fmt
.
Sprintf
(
"kubelet output:
\n
%s
\n
"
,
e2es
.
kubeletCombinedOut
.
String
()))
b
.
WriteString
(
"-------------------------------------------------------------
\n
"
)
b
.
WriteString
(
fmt
.
Sprintf
(
"apiserver output:
\n
%s"
,
e2es
.
apiServerCombinedOut
.
String
()))
b
.
WriteString
(
"-------------------------------------------------------------
\n
"
)
b
.
WriteString
(
fmt
.
Sprintf
(
"etcd output:
\n
%s"
,
e2es
.
etcdCombinedOut
.
String
()))
b
.
WriteString
(
fmt
.
Sprintf
(
"apiserver output:
\n
%s
\n
"
,
e2es
.
apiServerCombinedOut
.
String
()))
b
.
WriteString
(
"-------------------------------------------------------------
\n
"
)
glog
.
V
(
2
)
.
Infof
(
b
.
String
())
b
.
WriteString
(
fmt
.
Sprintf
(
"etcd output:
\n
%s
\n
"
,
e2es
.
etcdCombinedOut
.
String
()))
}
})
b
.
WriteString
(
"******************************************************
\n
"
)
glog
.
V
(
2
)
.
Infof
(
b
.
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