From d68dce480e5f9d08d0e024ee400ab36de67f0141 Mon Sep 17 00:00:00 2001 From: Parav Pandit Date: Fri, 6 Jul 2018 00:31:09 -0500 Subject: [PATCH] Ingress qdisc add/del Test case --- qdisc_test.go | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/qdisc_test.go b/qdisc_test.go index c8376b4..825b581 100644 --- a/qdisc_test.go +++ b/qdisc_test.go @@ -456,3 +456,42 @@ func TestFqCodelAddChangeDel(t *testing.T) { t.Fatal("Failed to remove qdisc") } } + +func TestIngressAddDel(t *testing.T) { + tearDown := setUpNetlinkTest(t) + defer tearDown() + if err := LinkAdd(&Ifb{LinkAttrs{Name: "foo"}}); err != nil { + t.Fatal(err) + } + link, err := LinkByName("foo") + if err != nil { + t.Fatal(err) + } + qdisc := &Ingress{ + QdiscAttrs: QdiscAttrs{ + LinkIndex: link.Attrs().Index, + Parent: HANDLE_INGRESS, + }, + } + err = QdiscAdd(qdisc) + if err != nil { + t.Fatal("Failed to add qdisc") + } + qdiscs, err := SafeQdiscList(link) + if err != nil { + t.Fatal("Failed to list qdisc") + } + if len(qdiscs) != 1 { + t.Fatal("Failed to add qdisc") + } + if err = QdiscDel(qdisc); err != nil { + t.Fatal(err) + } + qdiscs, err = SafeQdiscList(link) + if err != nil { + t.Fatal(err) + } + if len(qdiscs) != 0 { + t.Fatal("Failed to remove qdisc") + } +}