Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
ut: skip TestStartNetworkMonitor for non-root
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
bergwolf authored and Eric Ernst committed Aug 29, 2019
1 parent 31b8cb3 commit 50f48bb
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions virtcontainers/sandbox_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 50f48bb

Please sign in to comment.