Fix: deal properly with tc qdisc show returning "noqueue"

This commit is contained in:
Rudi Chiarito
2016-01-02 23:51:53 -05:00
parent ac7f85046a
commit ea56e508f0
2 changed files with 19 additions and 3 deletions

View File

@@ -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",