Skip to content

Commit 8021dc1

Browse files
authored
don't check file permissions if file doesn't exist (#199)
1 parent 765023a commit 8021dc1

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

pkg/types/v1/file_existence.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func (ft FileExistenceTest) Run(driver drivers.Driver) *types.TestResult {
8686
result.Errorf("File %s should not exist but does", ft.Path)
8787
result.Fail()
8888
}
89-
if ft.Permissions != "" {
89+
if ft.Permissions != "" && info != nil {
9090
perms := info.Mode()
9191
if perms.String() != ft.Permissions {
9292
result.Errorf("%s has incorrect permissions. Expected: %s, Actual: %s", ft.Path, ft.Permissions, perms.String())

pkg/types/v2/file_existence.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ func (ft FileExistenceTest) Run(driver drivers.Driver) *types.TestResult {
105105
result.Errorf("File %s should not exist but does", ft.Path)
106106
result.Fail()
107107
}
108-
if ft.Permissions != "" {
108+
if ft.Permissions != "" && info != nil {
109109
perms := info.Mode()
110110
if perms.String() != ft.Permissions {
111111
result.Errorf("%s has incorrect permissions. Expected: %s, Actual: %s", ft.Path, ft.Permissions, perms.String())

0 commit comments

Comments
 (0)