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

Commit

Permalink
Merge pull request #243 from jodh-intel/fix-TestIsHostDevice-test
Browse files Browse the repository at this point in the history
virtcontainers: Fix TestIsHostDevice test as non-root
  • Loading branch information
Sebastien Boeuf authored Apr 23, 2018
2 parents de32be7 + 53d73e5 commit 76af465
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion virtcontainers/mount_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ package virtcontainers
import (
"bytes"
"fmt"
"github.com/stretchr/testify/assert"
"os"
"os/exec"
"path/filepath"
"strconv"
"strings"
"syscall"
"testing"

"github.com/stretchr/testify/assert"
)

func TestIsSystemMount(t *testing.T) {
Expand Down Expand Up @@ -60,8 +61,14 @@ func TestIsHostDevice(t *testing.T) {
t.Fatalf("Expected result for path %s : %v, got %v", test.mnt, test.expected, result)
}
}
}

func TestIsHostDeviceCreateFile(t *testing.T) {
if os.Geteuid() != 0 {
t.Skip(testDisabledAsNonRoot)
}
// Create regular file in /dev

path := "/dev/foobar"
f, err := os.Create(path)
if err != nil {
Expand Down

0 comments on commit 76af465

Please sign in to comment.