mirror of
https://github.com/golang/go
synced 2024-11-19 07:04:43 -07:00
os/user: allow LookupGroupId to fail during test
On my Mac I am in group 5000 which apparently has no name (I suspect because it is an LDAP group and I cannot reach the LDAP server). Do not make the test fail in that case. Fixes #14806 Change-Id: I56b11a8e86b048abfb00812eaad37802fd2adcc5 Reviewed-on: https://go-review.googlesource.com/20710 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
cea5d26aa2
commit
80a0517129
@ -104,7 +104,11 @@ func TestLookupGroup(t *testing.T) {
|
||||
|
||||
g1, err := LookupGroupId(user.Gid)
|
||||
if err != nil {
|
||||
t.Fatalf("LookupGroupId(%q): %v", user.Gid, err)
|
||||
// NOTE(rsc): Maybe the group isn't defined. That's fine.
|
||||
// On my OS X laptop, rsc logs in with group 5000 even
|
||||
// though there's no name for group 5000. Such is Unix.
|
||||
t.Logf("LookupGroupId(%q): %v", user.Gid, err)
|
||||
return
|
||||
}
|
||||
if g1.Gid != user.Gid {
|
||||
t.Errorf("LookupGroupId(%q).Gid = %s; want %s", user.Gid, g1.Gid, user.Gid)
|
||||
|
Loading…
Reference in New Issue
Block a user