jiebi/CodeConvo huggingface dataset:
return oomScoreAdj } <del> // getCachedVersionInfo gets cached version info of docker runtime. func (dm *DockerManager) getCachedVersionInfo() (kubecontainer.Version, kubecontainer.Version, error) { apiVersion, daemonVersion, err := dm.versionCache.Get(dm.machineInfo.MachineID) if err != nil { glog.Errorf("Failed to get cached docker api version %v ", err) } // If we got nil versions, try to update version info. if apiVersion == nil || daemonVersion == nil { dm.versionCache.Update(dm.machineInfo.MachineID) } return apiVersion, daemonVersion, err } </del> // checkDockerAPIVersion checks current docker API version against expected version. // Return: // 1 : newer than expected version // -1: older than expected version // 0 : same version func (dm *DockerManager) checkDockerAPIVersion(expectedVersion string) (int, error) { <del> apiVersion, _, err := dm.getCachedVersionInfo() </del> <ins> apiVersion, _, err := dm.getVersionInfo() </ins> if err != nil { return 0, err }
// Generate final API pod status with pod and status manager status apiPodStatus := kl.generateAPIPodStatus(pod, podStatus) <ins> // The pod IP may be changed in generateAPIPodStatus if the pod is using host network. (See #24576) // TODO(random-liu): After writing pod spec into container labels, check whether pod is using host network, and // set pod IP to hostIP directly in runtime.GetPodStatus podStatus.IP = apiPodStatus.PodIP </ins> // Record the time it takes for the pod to become running. existingStatus, ok := kl.statusManager.GetPodStatus(pod.UID)
} } <ins> // ensureBridgeTxQueueLen() ensures that the bridge interface's TX queue // length is greater than zero.  Due to a CNI <= 0.3.0 'bridge' plugin bug, // the bridge is initially created with a TX queue length of 0, which gets // used as the packet limit for FIFO traffic shapers, which drops packets. // TODO: remove when we can depend on a fixed CNI func (plugin *kubenetNetworkPlugin) ensureBridgeTxQueueLen() { bridge, err := netlink.LinkByName(BridgeName) if err != nil { return } if bridge.Attrs().TxQLen > 0 { return } req := nl.NewNetlinkRequest(syscall.RTM_NEWLINK, syscall.NLM_F_ACK) msg := nl.NewIfInfomsg(syscall.AF_UNSPEC) req.AddData(msg) nameData := nl.NewRtAttr(syscall.IFLA_IFNAME, nl.ZeroTerminated(BridgeName)) req.AddData(nameData) qlen := nl.NewRtAttr(syscall.IFLA_TXQLEN, nl.Uint32Attr(1000)) req.AddData(qlen) _, err = req.Execute(syscall.NETLINK_ROUTE, 0) if err != nil { glog.V(5).Infof("Failed to set bridge tx queue length: %v", err) } } </ins> func (plugin *kubenetNetworkPlugin) Name() string { return KubenetPluginName }
// service account no longer exists, so delete related tokens glog.V(4).Infof("syncServiceAccount(%s/%s), service account deleted, removing tokens", saInfo.namespace, saInfo.name) sa = &v1.ServiceAccount{ObjectMeta: metav1.ObjectMeta{Namespace: saInfo.namespace, Name: saInfo.name, UID: saInfo.uid}} <del> if retriable, err := e.deleteTokens(sa); err != nil { </del> <ins> retry, err = e.deleteTokens(sa) if err != nil { </ins> glog.Errorf("error deleting serviceaccount tokens for %s/%s: %v", saInfo.namespace, saInfo.name, err) <del> retry = retriable </del> } default: // ensure a token exists and is referenced by this service account <del> if retriable, err := e.ensureReferencedToken(sa); err != nil { </del> <ins> retry, err = e.ensureReferencedToken(sa) if err != nil { </ins> glog.Errorf("error synchronizing serviceaccount %s/%s: %v", saInfo.namespace, saInfo.name, err) <del> retry = retriable </del> } } }
// ensureReferencedToken makes sure at least one ServiceAccountToken secret exists, and is included in the serviceAccount's Secrets list func (e *TokensController) ensureReferencedToken(serviceAccount *v1.ServiceAccount) ( /* retry */ bool, error) { <del> if len(serviceAccount.Secrets) > 0 { allSecrets, err := e.listTokenSecrets(serviceAccount) if err != nil { // Don't retry cache lookup errors return false, err } referencedSecrets := getSecretReferences(serviceAccount) for _, secret := range allSecrets { if referencedSecrets.Has(secret.Name) { // A service account token already exists, and is referenced, short-circuit return false, nil } } </del> <ins> if hasToken, err := e.hasReferencedToken(serviceAccount); err != nil { // Don't retry cache lookup errors return false, err } else if hasToken { // A service account token already exists, and is referenced, short-circuit return false, nil </ins> } // We don't want to update the cache's copy of the service account
serviceAccounts := e.client.Core().ServiceAccounts(serviceAccount.Namespace) liveServiceAccount, err := serviceAccounts.Get(serviceAccount.Name, metav1.GetOptions{}) if err != nil { <del> // Retry for any error other than a NotFound return !apierrors.IsNotFound(err), err </del> <ins> // Retry if we cannot fetch the live service account (for a NotFound error, either the live lookup or our cache are stale) return true, err </ins> } if liveServiceAccount.ResourceVersion != serviceAccount.ResourceVersion { <del> // our view of the service account is not up to date // we'll get notified of an update event later and get to try again glog.V(2).Infof("serviceaccount %s/%s is not up to date, skipping token creation", serviceAccount.Namespace, serviceAccount.Name) return false, nil </del> <ins> // Retry if our liveServiceAccount doesn't match our cache's resourceVersion (either the live lookup or our cache are stale) glog.V(4).Infof("liveServiceAccount.ResourceVersion (%s) does not match cache (%s), retrying", liveServiceAccount.ResourceVersion, serviceAccount.ResourceVersion) return true, nil </ins> } // Build the secret
// This prevents the service account update (below) triggering another token creation, if the referenced token couldn't be found in the store e.secrets.Add(createdToken) <del> liveServiceAccount.Secrets = append(liveServiceAccount.Secrets, v1.ObjectReference{Name: secret.Name}) </del> <ins> // Try to add a reference to the newly created token to the service account addedReference := false err = clientretry.RetryOnConflict(clientretry.DefaultRetry, func() error { // refresh liveServiceAccount on every retry defer func() { liveServiceAccount = nil }() // fetch the live service account if needed, and verify the UID matches and that we still need a token if liveServiceAccount == nil { liveServiceAccount, err = serviceAccounts.Get(serviceAccount.Name, metav1.GetOptions{}) if err != nil { return err } if liveServiceAccount.UID != serviceAccount.UID { // If we don't have the same service account, stop trying to add a reference to the token made for the old service account. return nil } if hasToken, err := e.hasReferencedToken(liveServiceAccount); err != nil { // Don't retry cache lookup errors return nil } else if hasToken { // A service account token already exists, and is referenced, short-circuit return nil } } // Try to add a reference to the token liveServiceAccount.Secrets = append(liveServiceAccount.Secrets, v1.ObjectReference{Name: secret.Name}) if _, err := serviceAccounts.Update(liveServiceAccount); err != nil { return err } </ins> <del> if _, err = serviceAccounts.Update(liveServiceAccount); err != nil { </del> <ins> addedReference = true return nil }) if !addedReference { </ins> // we weren't able to use the token, try to clean it up. glog.V(2).Infof("deleting secret %s/%s because reference couldn't be added (%v)", secret.Namespace, secret.Name, err) deleteOpts := &metav1.DeleteOptions{Preconditions: &metav1.Preconditions{UID: &createdToken.UID}} if deleteErr := e.client.Core().Secrets(createdToken.Namespace).Delete(createdToken.Name, deleteOpts); deleteErr != nil { glog.Error(deleteErr) // if we fail, just log it } <ins> } if err != nil { </ins> if apierrors.IsConflict(err) || apierrors.IsNotFound(err) { // if we got a Conflict error, the service account was updated by someone else, and we'll get an update notification later // if we got a NotFound error, the service account no longer exists, and we don't need to create a token for it
return false, nil } <ins> // hasReferencedToken returns true if the serviceAccount references a service account token secret func (e *TokensController) hasReferencedToken(serviceAccount *v1.ServiceAccount) (bool, error) { if len(serviceAccount.Secrets) == 0 { return false, nil } allSecrets, err := e.listTokenSecrets(serviceAccount) if err != nil { return false, err } referencedSecrets := getSecretReferences(serviceAccount) for _, secret := range allSecrets { if referencedSecrets.Has(secret.Name) { return true, nil } } return false, nil } </ins> func (e *TokensController) secretUpdateNeeded(secret *v1.Secret) (bool, bool, bool) { caData := secret.Data[v1.ServiceAccountRootCAKey] needsCA := len(e.rootCA) > 0 && bytes.Compare(caData, e.rootCA) != 0
t.Errorf("unexpected output: %s", buf.String()) } } <ins> func TestResourceErrors(t *testing.T) { testCases := map[string]struct { args  []string flags map[string]string errFn func(error) bool }{ "no args": { args:  []string{}, errFn: func(err error) bool { return strings.Contains(err.Error(), "you must provide one or more resources") }, }, "resources but no selectors": { args: []string{"pods"}, errFn: func(err error) bool { return strings.Contains(err.Error(), "resource(s) were provided, but no name, label selector, or --all flag specified") }, }, "multiple resources but no selectors": { args: []string{"pods,deployments"}, errFn: func(err error) bool { return strings.Contains(err.Error(), "resource(s) were provided, but no name, label selector, or --all flag specified") }, }, } for k, testCase := range testCases { f, tf, _ := NewAPIFactory() tf.Printer = &testPrinter{} tf.Namespace = "test" tf.ClientConfig = &restclient.Config{ContentConfig: restclient.ContentConfig{GroupVersion: testapi.Default.GroupVersion()}} buf := bytes.NewBuffer([]byte{}) cmd := NewCmdDelete(f, buf) cmd.SetOutput(buf) for k, v := range testCase.flags { cmd.Flags().Set(k, v) } err := RunDelete(f, buf, cmd, testCase.args, &DeleteOptions{}) if !testCase.errFn(err) { t.Errorf("%s: unexpected error: %v", k, err) continue } if tf.Printer.(*testPrinter).Objects != nil { t.Errorf("unexpected print to default printer") } if buf.Len() > 0 { t.Errorf("buffer should be empty: %s", string(buf.Bytes())) } } } </ins>
args:  []string{"pods=bar"}, errFn: func(err error) bool { return strings.Contains(err.Error(), "one or more resources must be specified") }, }, <ins> "resources but no selectors": { args: []string{"pods", "app=bar"}, errFn: func(err error) bool { return strings.Contains(err.Error(), "resource(s) were provided, but no name, label selector, or --all flag specified") }, }, "multiple resources but no selectors": { args: []string{"pods,deployments", "app=bar"}, errFn: func(err error) bool { return strings.Contains(err.Error(), "resource(s) were provided, but no name, label selector, or --all flag specified") }, }, </ins> } for k, testCase := range testCases {
return &Result{singular: singular, visitor: visitors, sources: b.paths} } <ins> if len(b.resources) != 0 { return &Result{err: fmt.Errorf("resource(s) were provided, but no name, label selector, or --all flag specified")} } </ins> return &Result{err: fmt.Errorf("you must provide one or more resources by argument or filename (%s)", strings.Join(InputExtensions, "|"))} }
type realConntracker struct{} <ins> var readOnlySysFSError = errors.New("ReadOnlySysFS") </ins> func (realConntracker) SetMax(max int) error { glog.Infof("Setting nf_conntrack_max to %d", max) if err := sysctl.SetSysctl("net/netfilter/nf_conntrack_max", max); err != nil { return err } <ins> // sysfs is expected to be mounted as 'rw'. However, it may be unexpectedly mounted as // 'ro' by docker because of a known docker issue (https://github.com/docker/docker/issues/24000). // Setting conntrack will fail when sysfs is readonly. When that happens, we don't set conntrack // hashsize and return a special error readOnlySysFSError here. The caller should deal with // readOnlySysFSError differently. writable, err := isSysFSWritable() if err != nil { return err } if !writable { return readOnlySysFSError } </ins> // TODO: generify this and sysctl to a new sysfs.WriteInt() glog.Infof("Setting conntrack hashsize to %d", max/4) return ioutil.WriteFile("/sys/module/nf_conntrack/parameters/hashsize", []byte(strconv.Itoa(max/4)), 0640)
glog.Infof("Setting nf_conntrack_tcp_timeout_established to %d", seconds) return sysctl.SetSysctl("net/netfilter/nf_conntrack_tcp_timeout_established", seconds) } <ins> // isSysFSWritable checks /proc/mounts to see whether sysfs is 'rw' or not. func isSysFSWritable() (bool, error) { const permWritable = "rw" const sysfsDevice = "sysfs" m := mount.New() mountPoints, err := m.List() if err != nil { glog.Errorf("failed to list mount points: %v", err) return false, err } for _, mountPoint := range mountPoints { if mountPoint.Device != sysfsDevice { continue } // Check whether sysfs is 'rw' if len(mountPoint.Opts) > 0 && mountPoint.Opts[0] == permWritable { return true, nil } glog.Errorf("sysfs is not writable: %+v", mountPoint) break } return false, nil } </ins>
// Tune conntrack, if requested if s.Conntracker != nil { if s.Config.ConntrackMax > 0 { <del> if err := s.Conntracker.SetMax(int(s.Config.ConntrackMax)); err != nil { return err </del> <ins> err := s.Conntracker.SetMax(int(s.Config.ConntrackMax)) if err != nil { if err != readOnlySysFSError { return err } // readOnlySysFSError is caused by a known docker issue (https://github.com/docker/docker/issues/24000), // the only remediation we know is to restart the docker daemon. // Here we'll send an node event with specific reason and message, the // administrator should decide whether and how to handle this issue, // whether to drain the node and restart docker. // TODO(random-liu): Remove this when the docker bug is fixed. const message = "DOCKER RESTART NEEDED (docker issue #24000): /sys is read-only: can't raise conntrack limits, problems may arise later." s.Recorder.Eventf(s.Config.NodeRef, api.EventTypeWarning, err.Error(), message) </ins> } } if s.Config.ConntrackTCPEstablishedTimeout.Duration > 0 {
return ConformanceContainer{containers[0], cc.Client, pod.Spec.RestartPolicy, pod.Spec.Volumes, pod.Spec.NodeName, cc.Namespace, cc.podName}, nil } <del> func (cc *ConformanceContainer) GetStatus() (api.ContainerStatus, api.PodPhase, error) { </del> <ins> func (cc *ConformanceContainer) IsReady() (bool, error) { </ins> pod, err := cc.Client.Pods(cc.Namespace).Get(cc.podName) if err != nil { <del> return api.ContainerStatus{}, api.PodUnknown, err </del> <ins> return false, err </ins> } <ins> return api.IsPodReady(pod), nil } func (cc *ConformanceContainer) GetPhase() (api.PodPhase, error) { pod, err := cc.Client.Pods(cc.Namespace).Get(cc.podName) if err != nil { return api.PodUnknown, err } return pod.Status.Phase, nil } func (cc *ConformanceContainer) GetStatus() (api.ContainerStatus, error) { pod, err := cc.Client.Pods(cc.Namespace).Get(cc.podName) if err != nil { return api.ContainerStatus{}, err } </ins> statuses := pod.Status.ContainerStatuses <del> if len(statuses) != 1 { return api.ContainerStatus{}, api.PodUnknown, errors.New("Failed to get container status") </del> <ins> if len(statuses) != 1 || statuses[0].Name != cc.Container.Name { return api.ContainerStatus{}, fmt.Errorf("unexpected container statuses %v", statuses) </ins> } <del> return statuses[0], pod.Status.Phase, nil </del> <ins> return statuses[0], nil </ins> } func (cc *ConformanceContainer) Present() (bool, error) {
}) Describe("container runtime conformance blackbox test", func() { <del> var testCContainers []ConformanceContainer </del> namespace := "runtime-conformance" <del> BeforeEach(func() { testCContainers = []ConformanceContainer{} }) Context("when start a container that exits successfully", func() { </del> <ins> Context("when starting a container that exits", func() { </ins> It("it should run with the expected status [Conformance]", func() { <ins> restartCountVolumeName := "restart-count" restartCountVolumePath := "/restart-count" </ins> testContainer := api.Container{ Image: ImageRegistry[busyBoxImage], VolumeMounts: []api.VolumeMount{ { <del> MountPath: "/restart-count", Name:      "restart-count", </del> <ins> MountPath: restartCountVolumePath, Name:      restartCountVolumeName, </ins> }, }, <del> ImagePullPolicy: api.PullIfNotPresent, </del> } testVolumes := []api.Volume{ { <del> Name: "restart-count", </del> <ins> Name: restartCountVolumeName, </ins> VolumeSource: api.VolumeSource{ HostPath: &api.HostPathVolumeSource{ Path: os.TempDir(),
Context("when running a container with invalid image", func() { It("it should run with the expected status [Conformance]", func() { testContainer := api.Container{ <del> Image:           "foo.com/foo/foo", Command:         []string{"false"}, ImagePullPolicy: api.PullIfNotPresent, </del> <ins> Image:   "foo.com/foo/foo", Command: []string{"false"}, </ins> } <del> testStatus := testStatus{"invalid-image-rpa", api.RestartPolicyAlways, api.PodPending, ContainerStateWaiting, "==", 0, false} testContainer.Name = testStatus.Name </del> <ins> testCase := testCase{"invalid-image-rpa", api.RestartPolicyAlways, api.PodPending, ContainerStateWaiting, "==", 0, false} testContainer.Name = testCase.Name </ins> invalidImageContainer := ConformanceContainer{ Container:     testContainer, Client:        cl, <del> RestartPolicy: testStatus.RestartPolicy, </del> <ins> RestartPolicy: testCase.RestartPolicy, </ins> NodeName:      *nodeName, Namespace:     namespace, } <del> err := invalidImageContainer.Create() Expect(err).NotTo(HaveOccurred()) testCContainers = append(testCContainers, invalidImageContainer) </del> <ins> Expect(invalidImageContainer.Create()).To(Succeed()) defer invalidImageContainer.Delete() </ins> <del> var status api.ContainerStatus var phase api.PodPhase </del> <ins> Eventually(invalidImageContainer.GetPhase, retryTimeout, pollInterval).Should(Equal(testCase.Phase)) Consistently(invalidImageContainer.GetPhase, consistentCheckTimeout, pollInterval).Should(Equal(testCase.Phase)) </ins> <del> Consistently(func() api.PodPhase { if status, phase, err = invalidImageContainer.GetStatus(); err != nil { return api.PodPending } else { return phase } }, consistentCheckTimeout, pollInterval).Should(Equal(testStatus.Phase)) </del> <ins> status, err := invalidImageContainer.GetStatus() </ins> Expect(err).NotTo(HaveOccurred()) By("it should get the expected 'RestartCount'") <del> Expect(status.RestartCount).To(BeNumerically(testStatus.RestartCountOper, testStatus.RestartCount)) </del> <ins> Expect(status.RestartCount).To(BeNumerically(testCase.RestartCountOper, testCase.RestartCount)) </ins> By("it should get the expected 'Ready' status") <del> Expect(status.Ready).To(Equal(testStatus.Ready)) </del> <ins> Expect(status.Ready).To(Equal(testCase.Ready)) </ins> By("it should get the expected 'State'") <del> Expect(GetContainerState(status.State) & testStatus.State).NotTo(Equal(0)) </del> <ins> Expect(GetContainerState(status.State)).To(Equal(testCase.State)) </ins> By("it should be possible to delete [Conformance]") <del> err = invalidImageContainer.Delete() Expect(err).NotTo(HaveOccurred()) Eventually(func() bool { isPresent, err := invalidImageContainer.Present() return err == nil && !isPresent }, retryTimeout, pollInterval).Should(BeTrue()) </del> <ins> Expect(invalidImageContainer.Delete()).To(Succeed()) Eventually(invalidImageContainer.Present, retryTimeout, pollInterval).Should(BeFalse()) </ins> }) }) <del> AfterEach(func() { for _, cc := range testCContainers { cc.Delete() } }) </del> }) })
clientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset" "k8s.io/kubernetes/pkg/runtime" deploymentutil "k8s.io/kubernetes/pkg/util/deployment" <del> "k8s.io/kubernetes/pkg/util/errors" </del> <ins> sliceutil "k8s.io/kubernetes/pkg/util/slice" </ins> ) const (
return fmt.Sprintf("No rollout history found in %s %q", resource, name), nil } // Sort the revisionToChangeCause map by revision <del> var revisions []string for k := range historyInfo.RevisionToTemplate { revisions = append(revisions, strconv.FormatInt(k, 10)) </del> <ins> var revisions []int64 for r := range historyInfo.RevisionToTemplate { revisions = append(revisions, r) </ins> } <del> sort.Strings(revisions) </del> <ins> sliceutil.SortInts64(revisions) </ins> return tabbedString(func(out io.Writer) error { fmt.Fprintf(out, "%s %q:n", resource, name) fmt.Fprintf(out, "REVISIONtCHANGE-CAUSEn") <del> errs := []error{} </del> for _, r := range revisions { // Find the change-cause of revision r <del> r64, err := strconv.ParseInt(r, 10, 64) if err != nil { errs = append(errs, err) continue } changeCause := historyInfo.RevisionToTemplate[r64].Annotations[ChangeCauseAnnotation] </del> <ins> changeCause := historyInfo.RevisionToTemplate[r].Annotations[ChangeCauseAnnotation] </ins> if len(changeCause) == 0 { changeCause = "<none>" } <del> fmt.Fprintf(out, "%st%sn", r, changeCause) </del> <ins> fmt.Fprintf(out, "%dt%sn", r, changeCause) </ins> } <del> return errors.NewAggregate(errs) </del> <ins> return nil </ins> }) }
} return shuffled } <ins> // Int64Slice attaches the methods of Interface to []int64, // sorting in increasing order. type Int64Slice []int64 func (p Int64Slice) Len() int           { return len(p) } func (p Int64Slice) Less(i, j int) bool { return p[i] < p[j] } func (p Int64Slice) Swap(i, j int)      { p[i], p[j] = p[j], p[i] } // Sorts []int64 in increasing order func SortInts64(a []int64) { sort.Sort(Int64Slice(a)) } </ins>
} } } <ins> func TestSortInts64(t *testing.T) { src := []int64{10, 1, 2, 3, 4, 5, 6} expected := []int64{1, 2, 3, 4, 5, 6, 10} SortInts64(src) if !reflect.DeepEqual(src, expected) { t.Errorf("func Ints64 didnt sort correctly, %v !- %v", src, expected) } } </ins>
numVolumes++ allErrs = append(allErrs, validateAzureFile(source.AzureFile, fldPath.Child("azureFile"))...) } <ins> if source.VsphereVolume != nil { if numVolumes > 0 { allErrs = append(allErrs, field.Forbidden(fldPath.Child("vsphereVolume"), "may not specify more than 1 volume type")) } else { numVolumes++ allErrs = append(allErrs, validateVsphereVolumeSource(source.VsphereVolume, fldPath.Child("vsphereVolume"))...) } } </ins> if numVolumes == 0 { allErrs = append(allErrs, field.Required(fldPath, "must specify a volume type")) }
return allErrs } <ins> func validateVsphereVolumeSource(cd *api.VsphereVirtualDiskVolumeSource, fldPath *field.Path) field.ErrorList { allErrs := field.ErrorList{} if len(cd.VolumePath) == 0 { allErrs = append(allErrs, field.Required(fldPath.Child("volumePath"), "")) } return allErrs } </ins> // ValidatePersistentVolumeName checks that a name is appropriate for a // PersistentVolumeName object. var ValidatePersistentVolumeName = NameIsDNSSubdomain
numVolumes++ allErrs = append(allErrs, validateAzureFile(pv.Spec.AzureFile, specPath.Child("azureFile"))...) } <ins> if pv.Spec.VsphereVolume != nil { if numVolumes > 0 { allErrs = append(allErrs, field.Forbidden(specPath.Child("vsphereVolume"), "may not specify more than 1 volume type")) } else { numVolumes++ allErrs = append(allErrs, validateVsphereVolumeSource(pv.Spec.VsphereVolume, specPath.Child("vsphereVolume"))...) } } </ins> if numVolumes == 0 { allErrs = append(allErrs, field.Required(specPath, "must specify a volume type")) }
pvc := createPVC("fake-pvc", "5G", []api.PersistentVolumeAccessMode{api.ReadWriteOnce}) <del> w, _ := testClient.PersistentVolumes().Watch(api.ListOptions{}) </del> <ins> w, err := testClient.PersistentVolumes().Watch(api.ListOptions{}) if err != nil { t.Errorf("Failed to watch PersistentVolumes: %v", err) } </ins> defer w.Stop() <del> _, _ = testClient.PersistentVolumes().Create(pv) _, _ = testClient.PersistentVolumeClaims(api.NamespaceDefault).Create(pvc) </del> <ins> _, err = testClient.PersistentVolumes().Create(pv) if err != nil { t.Errorf("Failed to create PersistentVolume: %v", err) } _, err = testClient.PersistentVolumeClaims(api.NamespaceDefault).Create(pvc) if err != nil { t.Errorf("Failed to create PersistentVolumeClaim: %v", err) } </ins> // wait until the controller pairs the volume and claim waitForPersistentVolumePhase(w, api.VolumeBound)