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
34a828d0
Commit
34a828d0
authored
May 25, 2016
by
Vishnu kannan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Link kernel log files to have them be copied over as part of node e2e.
Signed-off-by:
Vishnu kannan
<
vishnuk@google.com
>
parent
06f742a5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
73 additions
and
4 deletions
+73
-4
e2e_node_suite_test.go
test/e2e_node/e2e_node_suite_test.go
+7
-4
e2e_remote.go
test/e2e_node/e2e_remote.go
+1
-0
e2e_service.go
test/e2e_node/e2e_service.go
+65
-0
No files found.
test/e2e_node/e2e_node_suite_test.go
View file @
34a828d0
...
@@ -101,9 +101,12 @@ var _ = BeforeSuite(func() {
...
@@ -101,9 +101,12 @@ var _ = BeforeSuite(func() {
// Tear down the kubelet on the node
// Tear down the kubelet on the node
var
_
=
AfterSuite
(
func
()
{
var
_
=
AfterSuite
(
func
()
{
if
e2es
!=
nil
&&
*
startServices
&&
*
stopServices
{
if
e2es
!=
nil
{
glog
.
Infof
(
"Stopping node services..."
)
e2es
.
getLogFiles
()
e2es
.
stop
()
if
*
startServices
&&
*
stopServices
{
glog
.
Infof
(
"Stopping node services..."
)
e2es
.
stop
()
}
}
}
glog
.
Infof
(
"Tests Finished"
)
glog
.
Infof
(
"Tests Finished"
)
})
})
...
@@ -117,6 +120,6 @@ func maskLocksmithdOnCoreos() {
...
@@ -117,6 +120,6 @@ func maskLocksmithdOnCoreos() {
if
output
,
err
:=
exec
.
Command
(
"sudo"
,
"systemctl"
,
"mask"
,
"--now"
,
"locksmithd"
)
.
CombinedOutput
();
err
!=
nil
{
if
output
,
err
:=
exec
.
Command
(
"sudo"
,
"systemctl"
,
"mask"
,
"--now"
,
"locksmithd"
)
.
CombinedOutput
();
err
!=
nil
{
glog
.
Fatalf
(
"Could not mask locksmithd: %v, output: %q"
,
err
,
string
(
output
))
glog
.
Fatalf
(
"Could not mask locksmithd: %v, output: %q"
,
err
,
string
(
output
))
}
}
glog
.
Infof
(
"Locksmithd is masked successfully"
)
}
}
glog
.
Infof
(
"Locksmithd is masked successfully"
)
}
}
test/e2e_node/e2e_remote.go
View file @
34a828d0
...
@@ -188,6 +188,7 @@ func RunRemote(archive string, host string, cleanup bool, junitFileNumber int) (
...
@@ -188,6 +188,7 @@ func RunRemote(archive string, host string, cleanup bool, junitFileNumber int) (
glog
.
Infof
(
"Copying test artifacts from %s"
,
host
)
glog
.
Infof
(
"Copying test artifacts from %s"
,
host
)
scpErr
:=
getTestArtifacts
(
host
,
tmp
)
scpErr
:=
getTestArtifacts
(
host
,
tmp
)
exitOk
:=
true
exitOk
:=
true
glog
.
Errorf
(
"vishh: %v"
,
scpErr
)
if
scpErr
!=
nil
{
if
scpErr
!=
nil
{
// Only exit non-0 if the scp failed
// Only exit non-0 if the scp failed
exitOk
=
false
exitOk
=
false
...
...
test/e2e_node/e2e_service.go
View file @
34a828d0
...
@@ -75,6 +75,71 @@ func (es *e2eService) start() error {
...
@@ -75,6 +75,71 @@ func (es *e2eService) start() error {
return
nil
return
nil
}
}
// Get logs of interest either via journalctl or by creating sym links.
// Since we scp files from the remote directory, symlinks will be treated as normal files and file contents will be copied over.
func
(
es
*
e2eService
)
getLogFiles
()
{
// Special log files that need to be collected for additional debugging.
type
logFileData
struct
{
files
[]
string
journalctlCommand
[]
string
}
var
logFiles
=
map
[
string
]
logFileData
{
"kern.log"
:
{[]
string
{
"/var/log/kern.log"
},
[]
string
{
"-k"
}},
"docker.log"
:
{[]
string
{
"/var/log/docker.log"
,
"/var/log/upstart/docker.log"
},
[]
string
{
"-u"
,
"docker"
}},
}
// Nothing to do if report dir is not specified.
if
*
reportDir
==
""
{
return
}
journaldFound
:=
isJournaldAvailable
()
for
targetFileName
,
logFileData
:=
range
logFiles
{
targetLink
:=
path
.
Join
(
*
reportDir
,
targetFileName
)
if
journaldFound
{
// Skip log files that do not have an equivalent in journald based machines.
if
len
(
logFileData
.
journalctlCommand
)
==
0
{
continue
}
out
,
err
:=
exec
.
Command
(
"sudo"
,
append
([]
string
{
"journalctl"
},
logFileData
.
journalctlCommand
...
)
...
)
.
CombinedOutput
()
if
err
!=
nil
{
glog
.
Errorf
(
"failed to get %q from journald: %v, %v"
,
targetFileName
,
string
(
out
),
err
)
}
else
{
if
err
=
ioutil
.
WriteFile
(
targetLink
,
out
,
0755
);
err
!=
nil
{
glog
.
Errorf
(
"failed to write logs to %q: %v"
,
targetLink
,
err
)
}
}
continue
}
for
_
,
file
:=
range
logFileData
.
files
{
if
_
,
err
:=
os
.
Stat
(
file
);
err
!=
nil
{
// Expected file not found on this distro.
continue
}
if
err
:=
copyLogFile
(
file
,
targetLink
);
err
!=
nil
{
glog
.
Error
(
err
)
}
else
{
break
}
}
}
}
func
copyLogFile
(
src
,
target
string
)
error
{
// If not a journald based distro, then just symlink files.
if
out
,
err
:=
exec
.
Command
(
"sudo"
,
"cp"
,
src
,
target
)
.
CombinedOutput
();
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to copy %q to %q: %v, %v"
,
src
,
target
,
out
,
err
)
}
if
out
,
err
:=
exec
.
Command
(
"sudo"
,
"chmod"
,
"a+r"
,
target
)
.
CombinedOutput
();
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to make log file %q world readable: %v, %v"
,
target
,
out
,
err
)
}
return
nil
}
func
isJournaldAvailable
()
bool
{
_
,
err
:=
exec
.
LookPath
(
"journalctl"
)
return
err
==
nil
}
func
(
es
*
e2eService
)
stop
()
{
func
(
es
*
e2eService
)
stop
()
{
if
es
.
kubeletCmd
!=
nil
{
if
es
.
kubeletCmd
!=
nil
{
err
:=
es
.
kubeletCmd
.
Process
.
Kill
()
err
:=
es
.
kubeletCmd
.
Process
.
Kill
()
...
...
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