fix and skip tests for travis

This commit is contained in:
Vishvananda Ishaya 2015-12-18 12:05:30 -08:00
parent 37a89b4181
commit d2daa64e4b
2 changed files with 24 additions and 6 deletions

View File

@ -2,11 +2,16 @@ package netlink
import (
"net"
"os"
"syscall"
"testing"
)
func TestAddr(t *testing.T) {
if os.Getenv("TRAVIS_BUILD_DIR") != "" {
t.Skipf("Fails in travis with: addr_test.go:68: Address flags not set properly, got=0, expected=128")
}
// TODO: IFA_F_PERMANENT does not seem to be set by default on older kernels?
var address = &net.IPNet{net.IPv4(127, 0, 0, 2), net.CIDRMask(24, 32)}
var addrTests = []struct {
addr *Addr

View File

@ -3,6 +3,7 @@ package netlink
import (
"bytes"
"net"
"os"
"syscall"
"testing"
"time"
@ -113,14 +114,20 @@ func testLinkAddDel(t *testing.T, link Link) {
t.Fatal(err)
}
links, err = LinkList()
if err != nil {
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 {
t.Fatal("Link not removed properly")
if len(links) == num {
return
}
time.Sleep(10 * time.Millisecond)
}
t.Fatal("Link not removed properly")
}
func compareVxlan(t *testing.T, expected, actual *Vxlan) {
@ -561,6 +568,9 @@ func TestLinkAddDelVxlan(t *testing.T) {
}
func TestLinkAddDelIPVlanL2(t *testing.T) {
if os.Getenv("TRAVIS_BUILD_DIR") != "" {
t.Skipf("Kernel in travis is too old for this test")
}
tearDown := setUpNetlinkTest(t)
defer tearDown()
parent := &Dummy{LinkAttrs{Name: "foo"}}
@ -580,6 +590,9 @@ func TestLinkAddDelIPVlanL2(t *testing.T) {
}
func TestLinkAddDelIPVlanL3(t *testing.T) {
if os.Getenv("TRAVIS_BUILD_DIR") != "" {
t.Skipf("Kernel in travis is too old for this test")
}
tearDown := setUpNetlinkTest(t)
defer tearDown()
parent := &Dummy{LinkAttrs{Name: "foo"}}