Skip to content

Commit 23b0320

Browse files
committed
chore(tun): fix unit test for unprivileged user
1 parent 3e79509 commit 23b0320

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

internal/tun/tun_test.go

+5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ package tun
44

55
import (
66
"os"
7+
"strings"
78
"testing"
89

910
"github.com/stretchr/testify/require"
@@ -50,6 +51,10 @@ func Test_Tun(t *testing.T) {
5051

5152
// Create TUN device success
5253
err = tun.Create(path)
54+
if err != nil && strings.HasSuffix(err.Error(), "operation not permitted") {
55+
t.Skip("You do not have root privileges to create a TUN device, skipping test")
56+
return
57+
}
5358
require.NoError(t, err)
5459

5560
// Check TUN device success

0 commit comments

Comments
 (0)