mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 06:54:01 +00:00
Merge pull request #19238 from therc/master
Auto commit by PR queue bot
This commit is contained in:
commit
33085cc2ae
@ -224,6 +224,12 @@ func (t *tcShaper) interfaceExists() (bool, string, error) {
|
||||
if len(value) == 0 {
|
||||
return false, "", nil
|
||||
}
|
||||
// Newer versions of tc and/or the kernel return the following instead of nothing:
|
||||
// qdisc noqueue 0: root refcnt 2
|
||||
fields := strings.Fields(value)
|
||||
if len(fields) > 1 && fields[1] == "noqueue" {
|
||||
return false, "", nil
|
||||
}
|
||||
return true, value, nil
|
||||
}
|
||||
|
||||
|
@ -492,11 +492,11 @@ func TestReconcileInterfaceExists(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestReconcileInterfaceDoesntExist(t *testing.T) {
|
||||
func testReconcileInterfaceHasNoData(t *testing.T, output string) {
|
||||
fcmd := exec.FakeCmd{
|
||||
CombinedOutputScript: []exec.FakeCombinedOutputAction{
|
||||
func() ([]byte, error) { return []byte("\n"), nil },
|
||||
func() ([]byte, error) { return []byte("\n"), nil },
|
||||
func() ([]byte, error) { return []byte(output), nil },
|
||||
func() ([]byte, error) { return []byte(output), nil },
|
||||
},
|
||||
}
|
||||
|
||||
@ -549,6 +549,16 @@ func TestReconcileInterfaceDoesntExist(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestReconcileInterfaceDoesntExist(t *testing.T) {
|
||||
testReconcileInterfaceHasNoData(t, "\n")
|
||||
}
|
||||
|
||||
var tcQdiscNoqueue = "qdisc noqueue 0: root refcnt 2 \n"
|
||||
|
||||
func TestReconcileInterfaceExistsWithNoqueue(t *testing.T) {
|
||||
testReconcileInterfaceHasNoData(t, tcQdiscNoqueue)
|
||||
}
|
||||
|
||||
var tcQdiscWrong = []string{
|
||||
"qdisc htb 2: root refcnt 2 r2q 10 default 30 direct_packets_stat 0\n",
|
||||
"qdisc foo 1: root refcnt 2 r2q 10 default 30 direct_packets_stat 0\n",
|
||||
|
Loading…
Reference in New Issue
Block a user