From c4583f44866aaced4fd36d63f0be90640b1f69da Mon Sep 17 00:00:00 2001 From: Peng Tao Date: Fri, 19 Jul 2019 08:36:43 -0700 Subject: [PATCH] ut: skip TestStartNetworkMonitor for non-root It requires root to manipulate netns and otherwise fails like below: === RUN TestStartNetworkMonitor --- FAIL: TestStartNetworkMonitor (0.00s) Error Trace: sandbox_test.go:1481 Error: Expected nil, but got: &errors.errorString{s:"Error switching to ns /proc/6648/task/6651/ns/net: operation not permitted"} Signed-off-by: Peng Tao --- virtcontainers/sandbox_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/virtcontainers/sandbox_test.go b/virtcontainers/sandbox_test.go index 375d4c21c8..b4a058061a 100644 --- a/virtcontainers/sandbox_test.go +++ b/virtcontainers/sandbox_test.go @@ -1458,6 +1458,9 @@ func TestGetNetNs(t *testing.T) { } func TestStartNetworkMonitor(t *testing.T) { + if os.Getuid() != 0 { + t.Skip("Test disabled as requires root user") + } trueBinPath, err := exec.LookPath("true") assert.Nil(t, err) assert.NotEmpty(t, trueBinPath)