func()

in gke-deploy/testservices/kubectl.go [58:79]


func (k *TestKubectl) Get(ctx context.Context, kind, name, namespace, format string, ignoreNotFound bool) (string, error) {
	resp, ok := k.GetResponse[kind][name]
	if !ok {
		panic(fmt.Sprintf("GetResponse has no response for kind %q and name %q", kind, name))
	}

	if len(resp) == 0 {
		panic(fmt.Sprintf("GetResponse ran out of responses for kind %q and name %q after", kind, name))
	}
	res := resp[0].Res
	err := resp[0].Err

	if len(resp) == 1 {
		delete(k.GetResponse[kind], name)
		if len(k.GetResponse[kind]) == 0 {
			delete(k.GetResponse, kind)
		}
	} else {
		k.GetResponse[kind][name] = k.GetResponse[kind][name][1:]
	}
	return res, err
}