Commit 80a05171 authored by Russ Cox's avatar Russ Cox Committed by Brad Fitzpatrick

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/20710Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent cea5d26a
...@@ -104,7 +104,11 @@ func TestLookupGroup(t *testing.T) { ...@@ -104,7 +104,11 @@ func TestLookupGroup(t *testing.T) {
g1, err := LookupGroupId(user.Gid) g1, err := LookupGroupId(user.Gid)
if err != nil { 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 { if g1.Gid != user.Gid {
t.Errorf("LookupGroupId(%q).Gid = %s; want %s", user.Gid, g1.Gid, user.Gid) t.Errorf("LookupGroupId(%q).Gid = %s; want %s", user.Gid, g1.Gid, user.Gid)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment