You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: util_test.go
    path of file: ./repos/kubernetes/staging/src/k8s.io/apiserver/pkg/authentication/serviceaccount
    
    the code of the file until where you have to start completion: /*
Copyright 2014 The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package serviceaccount

import (
	"reflect"
	"testing"

	v1 "k8s.io/api/core/v1"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apiserver/pkg/authentication/user"
)

func TestUserInfo(t *testing.T) {
	tests := map[string]struct {
		info             ServiceAccountInfo
		expectedUserInfo *user.DefaultInfo
	}{
		"extracts pod name/uid": {
			info: ServiceAccountInfo{Name: "name", Namespace: "ns", PodName: "test", PodUID: "uid"},
			expectedUserInfo: &user.DefaultInfo{
				Name:   "system:serviceaccount:ns:name",
				Groups: []string{"system:serviceaccounts", "system:serviceaccounts:ns"},
				Extra: map[string][]string{
					"authentication.kubernetes.io/pod-name": {"test"},
					"authentication.kubernetes.io/pod-uid":  {"uid"},
				},
			},
		},
		"extracts node name/uid": {
			info: ServiceAccountInfo{Name: "name", Namespace: "ns", NodeName: "test", NodeUID: "uid"},
			expectedUserInfo: &user.DefaultInfo{
				Name:   "system:serviceaccount:ns:name",
				Groups: []string{"system:serviceaccounts", "system:serviceaccounts:ns"},
				Extra: map[string][]string{
					"authentication.kubernetes.io/node-name": {"test"},
					"authentication.kubernetes.io/node-uid":  {"uid"},
				},
			},
		},
		"extracts node name only": {
			info: ServiceAccountInfo{Name: "name", Namespace: "ns", NodeName: "t
    
func TestUserInfo(t *testing.T) {
	tests := map[string]struct {
		info             ServiceAccountInfo
		expectedUserInfo *user.DefaultInfo
	}{
		"extracts pod name/uid": {
			info: ServiceAccountInfo{Name: "name", Namespace: "ns", PodName: "test", PodUID: "uid"},
			expectedUserInfo: &user.DefaultInfo{
				Name:   "system:serviceaccount:ns:name",
				Groups: []string{"system:serviceaccounts", "system:serviceaccounts:ns"},
				Extra: map[string][]string{
					"authentication.kubernetes.io/pod-name": {"test"},
					"authentication.kubernetes.io/pod-uid":  {"uid"},
				},
			},
		},
		"extracts node name/uid": {
			info: ServiceAccountInfo{Name: "name", Namespace: "ns", NodeName: "test", NodeUID: "uid"},
			expectedUserInfo: &user.DefaultInfo{
				Name:   "system:serviceaccount:ns:name",
				Groups: []string{"system:serviceaccounts", "system:serviceaccounts:ns"},
				Extra: map[string][]string{
					"authentication.kubernetes.io/node-name": {"test"},
					"authentication.kubernetes.io/node-uid":  {"uid"},
				},
			},
		},
		"extracts node name only": {
			info: ServiceAccountInfo{Name: "name", Namespace: "ns", NodeName: "test"},
			expectedUserInfo: &user.DefaultInfo{
				Name:   "system:serviceaccount:ns:name",
				Groups: []string{"system:serviceaccounts", "system:serviceaccounts:ns"},
				Extra: map[string][]string{
					"authentication.kubernetes.io/node-name": {"test"},
				},
			},
		},
		"does not extract node UID if name is not set": {
			info: ServiceAccountInfo{Name: "name", Namespace: "ns", NodeUID: "test"},
			expectedUserInfo: &user.DefaultInfo{
				Name:   "system:serviceaccount:ns:name",
				Groups: []string{"system:serviceaccounts", "system:serviceaccounts:ns"},
			},
		},
	}

	for name, test := range tests {
		t.Run(name, func(t *testing.T) {
			userInfo := test.info.UserInfo()
			if !reflect.DeepEqual(userInfo, test.expectedUserInfo) {
				t.Errorf("expected %#v but got %#v", test.expectedUserInfo, userInfo)
			}
		})
	}
}