Skip to content

Commit

Permalink
chore: refactor after review
Browse files Browse the repository at this point in the history
  • Loading branch information
IronCore864 committed Sep 23, 2024
1 parent 8d2dd3b commit 79bb611
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
5 changes: 2 additions & 3 deletions internals/cli/cmd_add_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,9 @@ services:
} else if path == triggerLayerPath {
c.Assert(err, check.ErrorMatches, "triggered")
} else if path == unreadableLayerPath {
if os.Getuid() == 0 {
c.Skip("requires running as non-root users")
if os.Getuid() != 0 {
c.Assert(os.IsPermission(err), check.Equals, true)
}
c.Assert(os.IsPermission(err), check.Equals, true)
}
}

Expand Down
2 changes: 1 addition & 1 deletion internals/osutil/io_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func (ts *AtomicWriteTestSuite) TestAtomicWriteFileSymlinkNoFollow(c *C) {
defer os.Chmod(rodir, 0700)

if os.Getuid() == 0 {
c.Skip("requires running as non-root users")
c.Skip("requires running as non-root user")
}
err := osutil.AtomicWriteFile(p, []byte("hi"), 0600, 0)
c.Assert(err, NotNil)
Expand Down
4 changes: 2 additions & 2 deletions internals/osutil/stat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func makeTestPathInDir(c *C, dir string, path string, mode os.FileMode) string {

func (s *StatTestSuite) TestIsWritableDir(c *C) {
if os.Getuid() == 0 {
c.Skip("requires running as non-root users")
c.Skip("requires running as non-root user")
}

for _, t := range []struct {
Expand Down Expand Up @@ -185,7 +185,7 @@ func (s *StatTestSuite) TestExistsIsDir(c *C) {
}

if os.Getuid() == 0 {
c.Skip("requires running as non-root users")
c.Skip("requires running as non-root user")
}
p := makeTestPath(c, "foo/bar", 0)
c.Assert(os.Chmod(filepath.Dir(p), 0), IsNil)
Expand Down

0 comments on commit 79bb611

Please sign in to comment.