Merge pull request #18900 from hashicorp/b-skip-test-when-root
helper/pathorcontents: Skip one test when root
This commit is contained in:
commit
0005d93ab8
|
@ -4,6 +4,7 @@ import (
|
|||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/user"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
|
@ -63,6 +64,14 @@ func TestRead_TildePath(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestRead_PathNoPermission(t *testing.T) {
|
||||
// This skip condition is intended to get this test out of the way of users
|
||||
// who are building and testing Terraform from within a Linux-based Docker
|
||||
// container, where it is common for processes to be running as effectively
|
||||
// root within the container.
|
||||
if u, err := user.Current(); err == nil && u.Uid == "0" {
|
||||
t.Skip("This test is invalid when running as root, since root can read every file")
|
||||
}
|
||||
|
||||
isPath := true
|
||||
f, cleanup := testTempFile(t)
|
||||
defer cleanup()
|
||||
|
|
Loading…
Reference in New Issue