mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 05:57:25 +00:00
Fix two bugs in reboot tests
First, "ifconfig eth0 down/up" on Ubuntu and Debian breaks connection to the instance, thus tests after this one all fail. Second, replacing appending iptable rules with inserting them on the top of iptables, otherwise the tests may fail if iptables are not empty.
This commit is contained in:
parent
f21a6e9a93
commit
a1ba269ab3
@ -79,14 +79,14 @@ var _ = Describe("Reboot", func() {
|
||||
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 ifconfig eth0 down && sleep 120 && sudo ifconfig eth0 up' >/dev/null 2>&1 &")
|
||||
testReboot(c, "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 -A INPUT -s 127.0.0.1 -j ACCEPT && sudo iptables -A INPUT -j DROP && "+
|
||||
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 && "+
|
||||
" 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 +94,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 -A OUTPUT -s 127.0.0.1 -j ACCEPT && sudo iptables -A OUTPUT -j DROP && "+
|
||||
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 && "+
|
||||
" sleep 120 && sudo iptables -D OUTPUT -j DROP && sudo iptables -D OUTPUT -s 127.0.0.1 -j ACCEPT' >/dev/null 2>&1 &")
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user