Skip to content

Commit

Permalink
First check for uid 0, then lookup daemon's uid
Browse files Browse the repository at this point in the history
  • Loading branch information
greatroar committed Oct 29, 2020
1 parent 7c0f7ee commit 6752302
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions client_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ func TestClientRename(t *testing.T) {
defer sftp.Close()

dir, err := ioutil.TempDir("", "sftptest-rename")
require.Nil(t, err)
require.NoError(t, err)
defer os.RemoveAll(dir)
f, err := os.Create(filepath.Join(dir, "old"))
require.Nil(t, err)
Expand Down Expand Up @@ -835,15 +835,15 @@ func TestClientChown(t *testing.T) {
if err != nil {
t.Fatal(err)
}
chownto, err := user.Lookup("daemon") // seems common-ish...
if err != nil {
t.Fatal(err)
}

if usr.Uid != "0" {
t.Log("must be root to run chown tests")
t.Skip()
}

chownto, err := user.Lookup("daemon") // seems common-ish...
if err != nil {
t.Fatal(err)
}
toUID, err := strconv.Atoi(chownto.Uid)
if err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -896,15 +896,15 @@ func TestClientChownReadonly(t *testing.T) {
if err != nil {
t.Fatal(err)
}
chownto, err := user.Lookup("daemon") // seems common-ish...
if err != nil {
t.Fatal(err)
}

if usr.Uid != "0" {
t.Log("must be root to run chown tests")
t.Skip()
}

chownto, err := user.Lookup("daemon") // seems common-ish...
if err != nil {
t.Fatal(err)
}
toUID, err := strconv.Atoi(chownto.Uid)
if err != nil {
t.Fatal(err)
Expand Down

0 comments on commit 6752302

Please sign in to comment.