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
b76fef7d
Commit
b76fef7d
authored
Nov 04, 2015
by
Brendan Burns
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Log node info on test failures
parent
17c5c092
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
12 deletions
+29
-12
framework.go
test/e2e/framework.go
+2
-0
reboot.go
test/e2e/reboot.go
+7
-12
util.go
test/e2e/util.go
+20
-0
No files found.
test/e2e/framework.go
View file @
b76fef7d
...
...
@@ -102,6 +102,8 @@ func (f *Framework) afterEach() {
// you may or may not see the killing/deletion/cleanup events.
dumpAllPodInfo
(
f
.
Client
)
dumpAllNodeInfo
(
f
.
Client
)
}
// Check whether all nodes are ready after the test.
...
...
test/e2e/reboot.go
View file @
b76fef7d
...
...
@@ -26,7 +26,6 @@ import (
"k8s.io/kubernetes/pkg/labels"
.
"github.com/onsi/ginkgo"
.
"github.com/onsi/gomega"
)
const
(
...
...
@@ -44,13 +43,9 @@ const (
)
var
_
=
Describe
(
"Reboot"
,
func
()
{
var
c
*
client
.
Client
f
:=
NewFramework
(
"reboot"
)
BeforeEach
(
func
()
{
var
err
error
c
,
err
=
loadClient
()
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
// These tests requires SSH to nodes, so the provider check should be identical to there
// (the limiting factor is the implementation of util.go's getSigner(...)).
...
...
@@ -61,32 +56,32 @@ var _ = Describe("Reboot", func() {
It
(
"each node by ordering clean reboot and ensure they function upon restart"
,
func
()
{
// clean shutdown and restart
// We sleep 10 seconds to give some time for ssh command to cleanly finish before the node is rebooted.
testReboot
(
c
,
"nohup sh -c 'sleep 10 && sudo reboot' >/dev/null 2>&1 &"
)
testReboot
(
f
.
Client
,
"nohup sh -c 'sleep 10 && sudo reboot' >/dev/null 2>&1 &"
)
})
It
(
"each node by ordering unclean reboot and ensure they function upon restart"
,
func
()
{
// unclean shutdown and restart
// We sleep 10 seconds to give some time for ssh command to cleanly finish before the node is shutdown.
testReboot
(
c
,
"nohup sh -c 'sleep 10 && echo b | sudo tee /proc/sysrq-trigger' >/dev/null 2>&1 &"
)
testReboot
(
f
.
Client
,
"nohup sh -c 'sleep 10 && echo b | sudo tee /proc/sysrq-trigger' >/dev/null 2>&1 &"
)
})
It
(
"each node by triggering kernel panic and ensure they function upon restart"
,
func
()
{
// kernel panic
// We sleep 10 seconds to give some time for ssh command to cleanly finish before kernel panic is triggered.
testReboot
(
c
,
"nohup sh -c 'sleep 10 && echo c | sudo tee /proc/sysrq-trigger' >/dev/null 2>&1 &"
)
testReboot
(
f
.
Client
,
"nohup sh -c 'sleep 10 && echo c | sudo tee /proc/sysrq-trigger' >/dev/null 2>&1 &"
)
})
It
(
"each node by switching off the network interface and ensure they function upon switch on"
,
func
()
{
// switch the network interface off for a while to simulate a network outage
// We sleep 10 seconds to give some time for ssh command to cleanly finish before network is down.
testReboot
(
c
,
"nohup sh -c 'sleep 10 && sudo ifdown eth0 && sleep 120 && sudo ifup eth0' >/dev/null 2>&1 &"
)
testReboot
(
f
.
Client
,
"nohup sh -c 'sleep 10 && sudo ifdown eth0 && sleep 120 && sudo ifup eth0' >/dev/null 2>&1 &"
)
})
It
(
"each node by dropping all inbound packets for a while and ensure they function afterwards"
,
func
()
{
// tell the firewall to drop all inbound packets for a while
// We sleep 10 seconds to give some time for ssh command to cleanly finish before starting dropping inbound packets.
// We still accept packages send from localhost to prevent monit from restarting kubelet.
testReboot
(
c
,
"nohup sh -c 'sleep 10 && sudo iptables -I INPUT 1 -s 127.0.0.1 -j ACCEPT && sudo iptables -I INPUT 2 -j DROP && "
+
testReboot
(
f
.
Client
,
"nohup sh -c 'sleep 10 && sudo iptables -I INPUT 1 -s 127.0.0.1 -j ACCEPT && sudo iptables -I INPUT 2 -j DROP && "
+
" sleep 120 && sudo iptables -D INPUT -j DROP && sudo iptables -D INPUT -s 127.0.0.1 -j ACCEPT' >/dev/null 2>&1 &"
)
})
...
...
@@ -94,7 +89,7 @@ var _ = Describe("Reboot", func() {
// tell the firewall to drop all outbound packets for a while
// We sleep 10 seconds to give some time for ssh command to cleanly finish before starting dropping outbound packets.
// We still accept packages send to localhost to prevent monit from restarting kubelet.
testReboot
(
c
,
"nohup sh -c 'sleep 10 && sudo iptables -I OUTPUT 1 -s 127.0.0.1 -j ACCEPT && sudo iptables -I OUTPUT 2 -j DROP && "
+
testReboot
(
f
.
Client
,
"nohup sh -c 'sleep 10 && sudo iptables -I OUTPUT 1 -s 127.0.0.1 -j ACCEPT && sudo iptables -I OUTPUT 2 -j DROP && "
+
" sleep 120 && sudo iptables -D OUTPUT -j DROP && sudo iptables -D OUTPUT -s 127.0.0.1 -j ACCEPT' >/dev/null 2>&1 &"
)
})
})
...
...
test/e2e/util.go
View file @
b76fef7d
...
...
@@ -1477,8 +1477,28 @@ func dumpAllPodInfo(c *client.Client) {
logPodStates
(
pods
.
Items
)
}
func
dumpAllNodeInfo
(
c
*
client
.
Client
)
{
nodes
,
err
:=
c
.
Nodes
()
.
List
(
labels
.
Everything
(),
fields
.
Everything
())
if
err
!=
nil
{
Logf
(
"unable to fetch node list: %v"
,
err
)
return
}
names
:=
make
([]
string
,
len
(
nodes
.
Items
))
for
ix
:=
range
nodes
.
Items
{
names
[
ix
]
=
nodes
.
Items
[
ix
]
.
Name
}
dumpNodeDebugInfo
(
c
,
names
)
}
func
dumpNodeDebugInfo
(
c
*
client
.
Client
,
nodeNames
[]
string
)
{
for
_
,
n
:=
range
nodeNames
{
Logf
(
"
\n
Logging node info for node %v"
,
n
)
node
,
err
:=
c
.
Nodes
()
.
Get
(
n
)
if
err
!=
nil
{
Logf
(
"Error getting node info %v"
,
err
)
}
Logf
(
"Node Info: %v"
,
node
)
Logf
(
"
\n
Logging kubelet events for node %v"
,
n
)
for
_
,
e
:=
range
getNodeEvents
(
c
,
n
)
{
Logf
(
"source %v message %v reason %v first ts %v last ts %v, involved obj %+v"
,
...
...
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