diff --git a/ipn/ipnlocal/local.go b/ipn/ipnlocal/local.go index 969e4433a..915e6ddd7 100644 --- a/ipn/ipnlocal/local.go +++ b/ipn/ipnlocal/local.go @@ -1473,6 +1473,7 @@ func profileFromView(v tailcfg.UserProfileView) tailcfg.UserProfile { LoginName: v.LoginName(), DisplayName: v.DisplayName(), ProfilePicURL: v.ProfilePicURL(), + Groups: v.Groups().AsSlice(), } } return tailcfg.UserProfile{} diff --git a/ipn/ipnlocal/local_test.go b/ipn/ipnlocal/local_test.go index b9d8da046..544bc60ad 100644 --- a/ipn/ipnlocal/local_test.go +++ b/ipn/ipnlocal/local_test.go @@ -2070,19 +2070,21 @@ func TestWhoIs(t *testing.T) { }).View(), 20: (&tailcfg.UserProfile{ DisplayName: "Peer", + Groups: []string{"group:foo"}, }).View(), }, }) tests := []struct { - q string - want tailcfg.NodeID // 0 means want ok=false - wantName string + q string + want tailcfg.NodeID // 0 means want ok=false + wantName string + wantGroups []string }{ - {"100.101.102.103:0", 1, "Myself"}, - {"100.101.102.103:123", 1, "Myself"}, - {"100.200.200.200:0", 2, "Peer"}, - {"100.200.200.200:123", 2, "Peer"}, - {"100.4.0.4:404", 0, ""}, + {"100.101.102.103:0", 1, "Myself", nil}, + {"100.101.102.103:123", 1, "Myself", nil}, + {"100.200.200.200:0", 2, "Peer", []string{"group:foo"}}, + {"100.200.200.200:123", 2, "Peer", []string{"group:foo"}}, + {"100.4.0.4:404", 0, "", nil}, } for _, tt := range tests { t.Run(tt.q, func(t *testing.T) { @@ -2097,6 +2099,9 @@ func TestWhoIs(t *testing.T) { if up.DisplayName != tt.wantName { t.Errorf("got name %q; want %q", up.DisplayName, tt.wantName) } + if !slices.Equal(up.Groups, tt.wantGroups) { + t.Errorf("got groups %q; want %q", up.Groups, tt.wantGroups) + } }) } }