Add requirements to conntrack tests

Signed-off-by: Alessandro Boch <aboch@tetrationanalytics.com>
This commit is contained in:
Alessandro Boch 2017-11-27 15:10:25 -08:00 committed by Alessandro Boch
parent 9ce265f69e
commit 8bead6f932

View File

@ -77,6 +77,8 @@ func applyFilter(flowList []ConntrackFlow, ipv4Filter *ConntrackFilter, ipv6Filt
// TestConntrackSocket test the opening of a NETFILTER family socket
func TestConntrackSocket(t *testing.T) {
skipUnlessRoot(t)
setUpNetlinkTestWithKModule(t, "nf_conntrack")
setUpNetlinkTestWithKModule(t, "nf_conntrack_netlink")
h, err := NewHandle(unix.NETLINK_NETFILTER)
CheckErrorFail(t, err)
@ -90,6 +92,10 @@ func TestConntrackSocket(t *testing.T) {
// Creates some flows and checks that they are correctly fetched from the conntrack table
func TestConntrackTableList(t *testing.T) {
skipUnlessRoot(t)
setUpNetlinkTestWithKModule(t, "nf_conntrack")
setUpNetlinkTestWithKModule(t, "nf_conntrack_netlink")
setUpNetlinkTestWithKModule(t, "nf_conntrack_ipv4")
setUpNetlinkTestWithKModule(t, "nf_conntrack_ipv6")
// Creates a new namespace and bring up the loopback interface
origns, ns, h := nsCreateAndEnter(t)
@ -135,6 +141,9 @@ func TestConntrackTableList(t *testing.T) {
// Creates some flows and then call the table flush
func TestConntrackTableFlush(t *testing.T) {
skipUnlessRoot(t)
setUpNetlinkTestWithKModule(t, "nf_conntrack")
setUpNetlinkTestWithKModule(t, "nf_conntrack_netlink")
setUpNetlinkTestWithKModule(t, "nf_conntrack_ipv4")
// Creates a new namespace and bring up the loopback interface
origns, ns, h := nsCreateAndEnter(t)
@ -194,6 +203,9 @@ func TestConntrackTableFlush(t *testing.T) {
// Creates 2 group of flows then deletes only one group and validates the result
func TestConntrackTableDelete(t *testing.T) {
skipUnlessRoot(t)
setUpNetlinkTestWithKModule(t, "nf_conntrack")
setUpNetlinkTestWithKModule(t, "nf_conntrack_netlink")
setUpNetlinkTestWithKModule(t, "nf_conntrack_ipv4")
// Creates a new namespace and bring up the loopback interface
origns, ns, h := nsCreateAndEnter(t)