diff --git a/net/net_test.go b/net/net_test.go index aabce8174e73b15bd67ce09077df63ca1ac1bd55..30cef518acf4136fad53f0f1548350904d4bab36 100644 --- a/net/net_test.go +++ b/net/net_test.go @@ -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)