[net]linux: skip if "/proc/sys/net" is not exists on test environment.

v1
Shirou WAKAYAMA 9 years ago
parent fa3e1cc196
commit 1f32ce1bb3

@ -3,7 +3,10 @@ package net
import (
"fmt"
"os"
"runtime"
"testing"
"github.com/shirou/gopsutil/internal/common"
)
func TestAddrString(t *testing.T) {
@ -202,6 +205,13 @@ func TestNetFilterCounters(t *testing.T) {
return
}
if runtime.GOOS == "linux" {
// some test environment has not the path.
if !common.PathExists("/proc/sys/net/netfilter/nf_conntrack_count") {
t.SkipNow()
}
}
v, err := NetFilterCounters()
if err != nil {
t.Errorf("could not get NetConnections: %v", err)

Loading…
Cancel
Save