From bfd70f556483c008636b920dda142fdaa0d59ef9 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Fri, 18 Dec 2015 12:14:58 -0800 Subject: [PATCH] make the gre test pass --- .travis.yml | 3 +++ link_test.go | 21 ++++++++------------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index 30b6554..73a0374 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,8 @@ language: go before_script: + # make sure we keep path in tact when we sudo - sudo sed -i -e 's/^Defaults\tsecure_path.*$//' /etc/sudoers + # modprobe ip_gre or else the first gre device can't be deleted + - sudo modprobe ip_gre install: - go get github.com/vishvananda/netns diff --git a/link_test.go b/link_test.go index 70a31a3..dede987 100644 --- a/link_test.go +++ b/link_test.go @@ -114,20 +114,15 @@ func testLinkAddDel(t *testing.T, link Link) { t.Fatal(err) } - // It appears that some links don't disappear immediately. Specifically, - // the first GreTap device takes a moment to delete. - for i := 0; i < 10; i++ { - links, err = LinkList() - if err != nil { - t.Fatal(err) - } - - if len(links) == num { - return - } - time.Sleep(100 * time.Millisecond) + links, err = LinkList() + if err != nil { + t.Fatal(err) + } + + if len(links) != num { + t.Fatal("Link not removed properly") + return } - t.Fatal("Link not removed properly") } func compareVxlan(t *testing.T, expected, actual *Vxlan) {