提交 1f32ce1b 编写于 作者: S Shirou WAKAYAMA

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

上级 fa3e1cc1
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册