vishvananda / netlink

Simple netlink library for go.
Apache License 2.0
2.86k stars 747 forks source link

Testing - classes get returned double #355

Open fbegyn opened 6 years ago

fbegyn commented 6 years ago

The tests for classes fail on my system and other ones, since the classes seem to be returned double. So instead of having the expected 4 classes, 8 classes are found.

OUTPUT

$ sudo -E go test -v -run Class
=== RUN   TestClassAddDel
--- FAIL: TestClassAddDel (0.00s)
        class_test.go:90: Failed to add class
=== RUN   TestHtbClassAddHtbClassChangeDel
--- FAIL: TestHtbClassAddHtbClassChangeDel (0.00s)
        class_test.go:322: 1 class expected, 2 found
=== RUN   TestClassHfsc
--- FAIL: TestClassHfsc (0.00s)
        class_test.go:523: Failed to add classes
FAIL
exit status 1
FAIL    github.com/fbegyn/netlink       0.007s
$ uname -vro
4.16.9-1-ARCH #1 SMP PREEMPT Thu May 17 02:10:09 UTC 2018 GNU/Linux
fbegyn commented 6 years ago

Testing show that Debian based systems seem to be unaffected by this.

fbegyn commented 6 years ago

Since this issue solely existed on my dev machine and testing showed me that it is not present on other machines, nor that it is a representation of reality, I propose the following, resolve by removing the duplicated entries from the list before checking it. Done with SafeClassList on the basis that each handle should be unique, so there is only 1 class with the handle at any given time.

This solves the symptom, but not the root issue, which is yet to be found. Looking further into this.