jiebi/CodeConvo huggingface dataset:
// klog.V(4).Infof("rbd: info %s using mon %s, pool %s id %s key %s", b.Image, mon, b.Pool, id, secret) output, err = b.exec.Run("rbd", <del> "info", b.Image, "--pool", b.Pool, "-m", mon, "--id", id, "--key="+secret, "--format=json") </del> <ins> "info", b.Image, "--pool", b.Pool, "-m", mon, "--id", id, "--key="+secret, "-k=/dev/null", "--format=json") </ins> if err, ok := err.(*exec.Error); ok { if err.Err == exec.ErrNotFound {
cadvisorapi "github.com/google/cadvisor/info/v1" v1 "k8s.io/api/core/v1" <ins> apierrors "k8s.io/apimachinery/pkg/api/errors" </ins> metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/fields" "k8s.io/apimachinery/pkg/labels"
r := cache.NewReflector(nodeLW, &v1.Node{}, nodeIndexer, 0) go r.Run(wait.NeverStop) } <del> nodeInfo := &predicates.CachedNodeInfo{NodeLister: corelisters.NewNodeLister(nodeIndexer)} </del> <ins> nodeInfo := &CachedNodeInfo{NodeLister: corelisters.NewNodeLister(nodeIndexer)} </ins> // TODO: get the real node object of ourself, // and use the real node name and UID.
} return config } <ins> // CachedNodeInfo implements NodeInfo type CachedNodeInfo struct { corelisters.NodeLister } // GetNodeInfo returns cached data for the node name. func (c *CachedNodeInfo) GetNodeInfo(nodeName string) (*v1.Node, error) { node, err := c.Get(nodeName) if apierrors.IsNotFound(err) { return nil, err } if err != nil { return nil, fmt.Errorf("error retrieving node '%v' from cache: %v", nodeName, err) } return node, nil } </ins>
return c.PersistentVolumeClaims(namespace).Get(name) } <del> // CachedNodeInfo implements NodeInfo type CachedNodeInfo struct { corelisters.NodeLister } // GetNodeInfo returns cached data for the node 'id'. func (c *CachedNodeInfo) GetNodeInfo(id string) (*v1.Node, error) { node, err := c.Get(id) if apierrors.IsNotFound(err) { return nil, err } if err != nil { return nil, fmt.Errorf("error retrieving node '%v' from cache: %v", id, err) } return node, nil } </del> // StorageClassInfo interface represents anything that can get a storage class object by class name. type StorageClassInfo interface { GetStorageClassInfo(className string) (*storagev1.StorageClass, error)
StatefulSetLister:              c.statefulSetLister, NodeLister:                     &nodeLister{c.nodeLister}, PDBLister:                      c.pdbLister, <del> NodeInfo:                       &predicates.CachedNodeInfo{NodeLister: c.nodeLister}, </del> <ins> NodeInfo:                       c.schedulerCache, </ins> PVInfo:                         &predicates.CachedPersistentVolumeInfo{PersistentVolumeLister: c.pVLister}, PVCInfo:                        &predicates.CachedPersistentVolumeClaimInfo{PersistentVolumeClaimLister: c.pVCLister}, StorageClassInfo:               &predicates.CachedStorageClassInfo{StorageClassLister: c.storageClassLister},
func (cache *schedulerCache) NodeTree() *NodeTree { return cache.nodeTree } <ins> // GetNodeInfo returns cached data for the node name. func (cache *schedulerCache) GetNodeInfo(nodeName string) (*v1.Node, error) { cache.mu.RLock() defer cache.mu.RUnlock() n, ok := cache.nodes[nodeName] if !ok { return nil, fmt.Errorf("error retrieving node '%v' from cache", nodeName) } return n.info.Node(), nil } </ins>
"k8s.io/klog" ) <ins> var ( classShowMatcher      = regexp.MustCompile(`class htb (1:d+)`) classAndHandleMatcher = regexp.MustCompile(`filter parent 1:.*fh (d+::d+).*flowid (d+:d+)`) ) </ins> // tcShaper provides an implementation of the Shaper interface on Linux using the 'tc' tool. // In general, using this requires that the caller posses the NET_CAP_ADMIN capability, though if you // do this within an container, it only requires the NS_CAPABLE capability for manipulations to that
if len(line) == 0 { continue } <del> parts := strings.Split(line, " ") </del> // expected tc line: // class htb 1:1 root prio 0 rate 1000Kbit ceil 1000Kbit burst 1600b cburst 1600b <del> if len(parts) != 14 { return -1, fmt.Errorf("unexpected output from tc: %s (%v)", scanner.Text(), parts) </del> <ins> matches := classShowMatcher.FindStringSubmatch(line) if len(matches) != 2 { return -1, fmt.Errorf("unexpected output from tc: %s (%v)", scanner.Text(), matches) </ins> } <del> classes.Insert(parts[2]) </del> <ins> classes.Insert(matches[1]) </ins> } // Make sure it doesn't go forever
continue } if strings.Contains(line, spec) { <del> parts := strings.Split(filter, " ") </del> // expected tc line: <del> // filter parent 1: protocol ip pref 1 u32 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1:1 if len(parts) != 19 { return classAndHandleList, false, fmt.Errorf("unexpected output from tc: %s %d (%v)", filter, len(parts), parts) </del> <ins> // `filter parent 1: protocol ip pref 1 u32 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1:1` (old version) or // `filter parent 1: protocol ip pref 1 u32 chain 0 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1:1 not_in_hw` (new version) matches := classAndHandleMatcher.FindStringSubmatch(filter) if len(matches) != 3 { return classAndHandleList, false, fmt.Errorf("unexpected output from tc: %s %d (%v)", filter, len(matches), matches) </ins> } <del> resultTmp := []string{parts[18], parts[9]} </del> <ins> resultTmp := []string{matches[2], matches[1]} </ins> classAndHandleList = append(classAndHandleList, resultTmp) } }
filter parent 1: protocol ip pref 1 u32 fh 800::801 order 2049 key ht 800 bkt 0 flowid 1:2 match 01020000/ffff0000 at 16 ` <ins> var tcFilterOutputNewVersion = `filter parent 1: protocol ip pref 1 u32 filter parent 1: protocol ip pref 1 u32 chain 0 fh 800: ht divisor 1 filter parent 1: protocol ip pref 1 u32 chain 0 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1:1 not_in_hw match ac110002/ffffffff at 16 filter parent 1: protocol ip pref 1 u32 chain 0 fh 800::801 order 2049 key ht 800 bkt 0 flowid 1:2 not_in_hw match 01020000/ffff0000 at 16 ` </ins> func TestFindCIDRClass(t *testing.T) { tests := []struct {
expectNotFound: true, }, { <ins> cidr:           "172.17.0.2/32", output:         tcFilterOutputNewVersion, expectedClass:  "1:1", expectedHandle: "800::800", }, { cidr:           "1.2.3.4/16", output:         tcFilterOutputNewVersion, expectedClass:  "1:2", expectedHandle: "800::801", }, { cidr:           "2.2.3.4/16", output:         tcFilterOutputNewVersion, expectNotFound: true, }, { </ins> err:       errors.New("test error"), expectErr: true, },
registry := RegistryList{ DockerLibraryRegistry: "docker.io/library", E2eRegistry:           "gcr.io/kubernetes-e2e-test-images", <del> EtcdRegistry:          "quay.io/coreos", </del> GcRegistry:            "k8s.gcr.io", PrivateRegistry:       "gcr.io/k8s-authenticated-test", SampleRegistry:        "gcr.io/google-samples",
configs[Dnsutils] = Config{e2eRegistry, "dnsutils", "1.1"} configs[EchoServer] = Config{e2eRegistry, "echoserver", "2.2"} configs[EntrypointTester] = Config{e2eRegistry, "entrypoint-tester", "1.0"} <del> configs[Etcd] = Config{etcdRegistry, "etcd", "v3.3.10"} </del> <ins> configs[Etcd] = Config{gcRegistry, "etcd", "3.3.10"} </ins> configs[Fakegitserver] = Config{e2eRegistry, "fakegitserver", "1.0"} configs[GBFrontend] = Config{sampleRegistry, "gb-frontend", "v6"} configs[GBRedisSlave] = Config{sampleRegistry, "gb-redisslave", "v3"}
"//staging/src/k8s.io/apimachinery/pkg/labels:go_default_library", "//staging/src/k8s.io/apiserver/pkg/admission:go_default_library", "//staging/src/k8s.io/apiserver/pkg/admission/initializer:go_default_library", <del> "//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library", </del> "//staging/src/k8s.io/client-go/informers:go_default_library", "//staging/src/k8s.io/client-go/kubernetes:go_default_library", "//staging/src/k8s.io/client-go/listers/scheduling/v1:go_default_library", <ins> "//staging/src/k8s.io/component-base/featuregate:go_default_library", </ins> ], )
"k8s.io/apimachinery/pkg/labels" "k8s.io/apiserver/pkg/admission" genericadmissioninitializers "k8s.io/apiserver/pkg/admission/initializer" <del> utilfeature "k8s.io/apiserver/pkg/util/feature" </del> "k8s.io/client-go/informers" "k8s.io/client-go/kubernetes" schedulingv1listers "k8s.io/client-go/listers/scheduling/v1" <ins> "k8s.io/component-base/featuregate" </ins> "k8s.io/kubernetes/pkg/apis/core" api "k8s.io/kubernetes/pkg/apis/core" "k8s.io/kubernetes/pkg/apis/scheduling"
// Plugin is an implementation of admission.Interface. type Plugin struct { *admission.Handler <del> client kubernetes.Interface lister schedulingv1listers.PriorityClassLister </del> <ins> client                          kubernetes.Interface lister                          schedulingv1listers.PriorityClassLister resourceQuotaFeatureGateEnabled bool nonPreemptingPriority           bool </ins> } var _ admission.MutationInterface = &Plugin{} var _ admission.ValidationInterface = &Plugin{} <ins> var _ genericadmissioninitializers.WantsFeatures = &Plugin{} </ins> var _ = genericadmissioninitializers.WantsExternalKubeInformerFactory(&Plugin{}) var _ = genericadmissioninitializers.WantsExternalKubeClientSet(&Plugin{})
return nil } <ins> // InspectFeatureGates allows setting bools without taking a dep on a global variable func (p *Plugin) InspectFeatureGates(featureGates featuregate.FeatureGate) { p.nonPreemptingPriority = featureGates.Enabled(features.NonPreemptingPriority) p.resourceQuotaFeatureGateEnabled = featureGates.Enabled(features.ResourceQuotaScopeSelectors) } </ins> // SetExternalKubeClientSet implements the WantsInternalKubeClientSet interface. func (p *Plugin) SetExternalKubeClientSet(client kubernetes.Interface) { p.client = client
pod.Spec.PriorityClassName = pcName } else { pcName := pod.Spec.PriorityClassName <del> if !priorityClassPermittedInNamespace(pcName, a.GetNamespace()) { return admission.NewForbidden(a, fmt.Errorf("pods with %v priorityClass is not permitted in %v namespace", pcName, a.GetNamespace())) </del> <ins> // If ResourceQuotaScopeSelectors is enabled, we should let pods with critical priorityClass to be created // any namespace where administrator wants it to be created. if !p.resourceQuotaFeatureGateEnabled { if !priorityClassPermittedInNamespace(pcName, a.GetNamespace()) { return admission.NewForbidden(a, fmt.Errorf("pods with %v priorityClass is not permitted in %v namespace", pcName, a.GetNamespace())) } </ins> } // Try resolving the priority class name.
for _, test := range tests { klog.V(4).Infof("starting test %q", test.name) ctrl := NewPlugin() <ins> ctrl.resourceQuotaFeatureGateEnabled = true ctrl.nonPreemptingPriority = true </ins> // Add existing priority classes. if err := addPriorityClasses(ctrl, test.existingClasses); err != nil { t.Errorf("Test %q: unable to add object to informer: %v", test.name, err)
# Taint Windows nodes by default to prevent Linux workloads from being # scheduled onto them. WINDOWS_NODE_TAINTS="${WINDOWS_NODE_TAINTS:-node.kubernetes.io/os=win1809:NoSchedule}" <ins> # Whether to set up a private GCE cluster, i.e. a cluster where nodes have only private IPs. GCE_PRIVATE_CLUSTER="${KUBE_GCE_PRIVATE_CLUSTER:-false}" </ins>
if [[ "${enable_ip_alias}" == 'true' ]]; then ret="--network-interface" ret="${ret} network=${networkURL}" <del> # If address is omitted, instance will not receive an external IP. ret="${ret},address=${address:-}" </del> <ins> if [[ "${address:-}" == "no-address" ]]; then ret="${ret},no-address" else ret="${ret},address=${address:-}" fi </ins> ret="${ret},subnet=${subnetURL}" ret="${ret},aliases=pods-default:${alias_size}" ret="${ret} --no-can-ip-forward"
fi fi <ins> local address="" if [[ ${GCE_PRIVATE_CLUSTER:-} == "true" ]]; then address="no-address" fi </ins> local network=$(make-gcloud-network-argument  "${NETWORK_PROJECT}"  "${REGION}"  "${NETWORK}"  "${SUBNETWORK:-}"  <del> ""  </del> <ins> "${address}"  </ins> "${ENABLE_IP_ALIASES:-}"  "${IP_ALIAS_SIZE:-}")
echo "${color_red}Could not find subnetwork with region ${REGION}, network ${NETWORK}, and project ${NETWORK_PROJECT}" } <ins> # Sets up Cloud NAT for the network. # Assumed vars: #   NETWORK_PROJECT #   REGION #   NETWORK function create-cloud-nat-router() { if [[ ${GCE_PRIVATE_CLUSTER:-} == "true" ]]; then gcloud compute routers create "$NETWORK-nat-router"  --project $NETWORK_PROJECT  --region $REGION  --network $NETWORK gcloud compute routers nats create "$NETWORK-nat-config"  --project $NETWORK_PROJECT  --router-region $REGION  --router "$NETWORK-nat-router"  --nat-all-subnet-ip-ranges  --auto-allocate-nat-external-ips fi } </ins> function delete-all-firewall-rules() { if fws=$(gcloud compute firewall-rules list --project "${NETWORK_PROJECT}" --filter="network=${NETWORK}" --format="value(name)"); then echo "Deleting firewall rules remaining in network ${NETWORK}: ${fws}"
fi } <ins> function delete-cloud-nat-router() { if [[ ${GCE_PRIVATE_CLUSTER:-} == "true" ]]; then if [[ -n $(gcloud compute routers describe --project "${NETWORK_PROJECT}" --region "${REGION}" "${NETWORK}-nat-router" --format='value(name)' 2>/dev/null || true) ]]; then echo "Deleting Cloud NAT router..." gcloud compute routers delete --project "${NETWORK_PROJECT}" --region "${REGION}" --quiet "${NETWORK}-nat-router" fi fi } </ins> function delete-subnetworks() { # If running in custom mode network we need to delete subnets manually. mode="$(check-network-mode)"
func GetNodeAddresses(node *v1.Node, addressType v1.NodeAddressType) (ips []string) { for j := range node.Status.Addresses { nodeAddress := &node.Status.Addresses[j] <del> if nodeAddress.Type == addressType { </del> <ins> if nodeAddress.Type == addressType && nodeAddress.Address != "" { </ins> ips = append(ips, nodeAddress.Address) } }
return nil, err } <del> disks := *vm.StorageProfile.DataDisks </del> <ins> disks := make([]compute.DataDisk, len(*vm.StorageProfile.DataDisks)) copy(disks, *vm.StorageProfile.DataDisks) </ins> bFoundDisk := false for i, disk := range disks { if disk.Lun != nil && (disk.Name != nil && diskName != "" && *disk.Name == diskName) ||
disks := []compute.DataDisk{} if vm.StorageProfile != nil && vm.StorageProfile.DataDisks != nil { <del> disks = *vm.StorageProfile.DataDisks </del> <ins> disks = make([]compute.DataDisk, len(*vm.StorageProfile.DataDisks)) copy(disks, *vm.StorageProfile.DataDisks) </ins> } if isManagedDisk { disks = append(disks,
disks := []compute.DataDisk{} if vm.StorageProfile != nil && vm.StorageProfile.DataDisks != nil { <del> disks = *vm.StorageProfile.DataDisks </del> <ins> disks = make([]compute.DataDisk, len(*vm.StorageProfile.DataDisks)) copy(disks, *vm.StorageProfile.DataDisks) </ins> } bFoundDisk := false for i, disk := range disks {
return newRS, allOldRSs, nil } <ins> const ( // limit revision history length to 100 element (~2000 chars) maxRevHistoryLengthInChars = 2000 ) </ins> // Returns a replica set that matches the intent of the given deployment. Returns nil if the new replica set doesn't exist yet. // 1. Get existing new RS (the RS that the given deployment targets, whose pod template is the same as deployment's). // 2. If there's existing new RS, update its revision number if it's smaller than (maxOldRevision + 1), where maxOldRevision is the max revision number among all old RSes.
rsCopy := existingNewRS.DeepCopy() // Set existing new replica set's annotation <del> annotationsUpdated := deploymentutil.SetNewReplicaSetAnnotations(d, rsCopy, newRevision, true) </del> <ins> annotationsUpdated := deploymentutil.SetNewReplicaSetAnnotations(d, rsCopy, newRevision, true, maxRevHistoryLengthInChars) </ins> minReadySecondsNeedsUpdate := rsCopy.Spec.MinReadySeconds != d.Spec.MinReadySeconds if annotationsUpdated || minReadySecondsNeedsUpdate { rsCopy.Spec.MinReadySeconds = d.Spec.MinReadySeconds
*(newRS.Spec.Replicas) = newReplicasCount // Set new replica set's annotation <del> deploymentutil.SetNewReplicaSetAnnotations(d, &newRS, newRevision, false) </del> <ins> deploymentutil.SetNewReplicaSetAnnotations(d, &newRS, newRevision, false, maxRevHistoryLengthInChars) </ins> // Create the new ReplicaSet. If it already exists, then we need to check for possible // hash collisions. If there is any other error, we need to report it in the status of // the Deployment.
// SetNewReplicaSetAnnotations sets new replica set's annotations appropriately by updating its revision and // copying required deployment annotations to it; it returns true if replica set's annotation is changed. <del> func SetNewReplicaSetAnnotations(deployment *apps.Deployment, newRS *apps.ReplicaSet, newRevision string, exists bool) bool { </del> <ins> func SetNewReplicaSetAnnotations(deployment *apps.Deployment, newRS *apps.ReplicaSet, newRevision string, exists bool, revHistoryLimitInChars int) bool { </ins> // First, copy deployment's annotations (except for apply and revision annotations) annotationChanged := copyDeploymentAnnotationsToReplicaSet(deployment, newRS) // Then, update replica set's revision annotation
// If a revision annotation already existed and this replica set was updated with a new revision // then that means we are rolling back to this replica set. We need to preserve the old revisions // for historical information. <del> if ok && annotationChanged { </del> <ins> if ok && oldRevisionInt < newRevisionInt { </ins> revisionHistoryAnnotation := newRS.Annotations[RevisionHistoryAnnotation] oldRevisions := strings.Split(revisionHistoryAnnotation, ",") if len(oldRevisions[0]) == 0 { newRS.Annotations[RevisionHistoryAnnotation] = oldRevision } else { <del> oldRevisions = append(oldRevisions, oldRevision) newRS.Annotations[RevisionHistoryAnnotation] = strings.Join(oldRevisions, ",") </del> <ins> totalLen := len(revisionHistoryAnnotation) + len(oldRevision) + 1 // index for the starting position in oldRevisions start := 0 for totalLen > revHistoryLimitInChars && start < len(oldRevisions) { totalLen = totalLen - len(oldRevisions[start]) - 1 start++ } if totalLen <= revHistoryLimitInChars { oldRevisions = append(oldRevisions[start:], oldRevision) newRS.Annotations[RevisionHistoryAnnotation] = strings.Join(oldRevisions, ",") } else { klog.Warningf("Not appending revision due to length limit of %v reached", revHistoryLimitInChars) } </ins> } } // If the new replica set is about to be created, we need to add replica annotations to it.
//Test Case 1: Check if anotations are copied properly from deployment to RS t.Run("SetNewReplicaSetAnnotations", func(t *testing.T) { <del> //Try to set the increment revision from 1 through 20 for i := 0; i < 20; i++ { </del> <ins> //Try to set the increment revision from 11 through 20 for i := 10; i < 20; i++ { </ins> nextRevision := fmt.Sprintf("%d", i+1) <del> SetNewReplicaSetAnnotations(&tDeployment, &tRS, nextRevision, true) </del> <ins> SetNewReplicaSetAnnotations(&tDeployment, &tRS, nextRevision, true, 5) </ins> //Now the ReplicaSets Revision Annotation should be i+1 <ins> if i >= 12 { expectedHistoryAnnotation := fmt.Sprintf("%d,%d", i-1, i) if tRS.Annotations[RevisionHistoryAnnotation] != expectedHistoryAnnotation { t.Errorf("Revision History Expected=%s Obtained=%s", expectedHistoryAnnotation, tRS.Annotations[RevisionHistoryAnnotation]) } } </ins> if tRS.Annotations[RevisionAnnotation] != nextRevision { t.Errorf("Revision Expected=%s Obtained=%s", nextRevision, tRS.Annotations[RevisionAnnotation]) }
} // writeLogs writes logs into stdout, stderr. <del> func (w *logWriter) write(msg *logMessage) error { </del> <ins> func (w *logWriter) write(msg *logMessage, addPrefix bool) error { </ins> if msg.timestamp.Before(w.opts.since) { // Skip the line because it's older than since return nil } line := msg.log <del> if w.opts.timestamp { </del> <ins> if w.opts.timestamp && addPrefix { </ins> prefix := append([]byte(msg.timestamp.Format(timeFormatOut)), delimiter[0]) line = append(prefix, line...) }
stdoutBuf := bytes.NewBuffer(nil) stderrBuf := bytes.NewBuffer(nil) w := newLogWriter(stdoutBuf, stderrBuf, &LogOptions{since: test.since, timestamp: test.timestamp, bytes: -1}) <del> err := w.write(msg) </del> <ins> err := w.write(msg, true) </ins> assert.NoError(t, err) assert.Equal(t, test.expectStdout, stdoutBuf.String()) assert.Equal(t, test.expectStderr, stderrBuf.String())
w := newLogWriter(stdoutBuf, stderrBuf, &LogOptions{timestamp: test.timestamp, bytes: int64(test.bytes)}) for i := 0; i < test.stdoutLines; i++ { msg.stream = runtimeapi.Stdout <del> if err := w.write(msg); err != nil { </del> <ins> if err := w.write(msg, true); err != nil { </ins> assert.EqualError(t, err, errMaximumWrite.Error()) } } for i := 0; i < test.stderrLines; i++ { msg.stream = runtimeapi.Stderr <del> if err := w.write(msg); err != nil { </del> <ins> if err := w.write(msg, true); err != nil { </ins> assert.EqualError(t, err, errMaximumWrite.Error()) } }
assert.Equal(t, test.expectStderr, stderrBuf.String()) } } <ins> func TestReadLogsLimitsWithTimestamps(t *testing.T) { logLineFmt := "2022-10-29T16:10:22.592603036-05:00 stdout P %vn" logLineNewLine := "2022-10-29T16:10:22.592603036-05:00 stdout F n" tmpfile, err := ioutil.TempFile("", "log.*.txt") assert.NoError(t, err) count := 10000 for i := 0; i < count; i++ { tmpfile.WriteString(fmt.Sprintf(logLineFmt, i)) } tmpfile.WriteString(logLineNewLine) for i := 0; i < count; i++ { tmpfile.WriteString(fmt.Sprintf(logLineFmt, i)) } tmpfile.WriteString(logLineNewLine) // two lines are in the buffer defer os.Remove(tmpfile.Name()) // clean up assert.NoError(t, err) tmpfile.Close() var buf bytes.Buffer w := io.MultiWriter(&buf) err = ReadLogs(context.Background(), tmpfile.Name(), "", &LogOptions{tail: -1, bytes: -1, timestamp: true}, nil, w, w) assert.NoError(t, err) lineCount := 0 scanner := bufio.NewScanner(bytes.NewReader(buf.Bytes())) for scanner.Scan() { lineCount++ // Split the line ts, logline, _ := bytes.Cut(scanner.Bytes(), []byte(" ")) // Verification //   1. The timestamp should exist //   2. The last item in the log should be 9999 _, err = time.Parse(time.RFC3339, string(ts)) assert.NoError(t, err, "timestamp not found") assert.Equal(t, true, bytes.HasSuffix(logline, []byte("9999")), "is the complete log found") } assert.Equal(t, 2, lineCount, "should have two lines") } </ins>
volumeToAttach.VolumeSpec, volumeToAttach.NodeName) if attachErr != nil { <ins> uncertainNode := volumeToAttach.NodeName </ins> if derr, ok := attachErr.(*volerr.DanglingAttachError); ok { <del> addErr := actualStateOfWorld.MarkVolumeAsAttached( v1.UniqueVolumeName(""), originalSpec, derr.CurrentNode, derr.DevicePath) if addErr != nil { klog.Errorf("AttachVolume.MarkVolumeAsAttached failed to fix dangling volume error for volume %q with %s", volumeToAttach.VolumeName, addErr) } } else { addErr := actualStateOfWorld.MarkVolumeAsUncertain( v1.UniqueVolumeName(""), originalSpec, volumeToAttach.NodeName) if addErr != nil { klog.Errorf("AttachVolume.MarkVolumeAsUncertain fail to add the volume %q to actual state with %s", volumeToAttach.VolumeName, addErr) } </del> <ins> uncertainNode = derr.CurrentNode } addErr := actualStateOfWorld.MarkVolumeAsUncertain( v1.UniqueVolumeName(""), originalSpec, uncertainNode) if addErr != nil { klog.Errorf("AttachVolume.MarkVolumeAsUncertain fail to add the volume %q to actual state with %s", volumeToAttach.VolumeName, addErr) </ins> } // On failure, return error. Caller will log and retry. return volumeToAttach.GenerateError("AttachVolume.Attach failed", attachErr) }
metricsGrabber, err := metrics.NewMetricsGrabber(c, nil, true, false, true, false, false) if err != nil { <del> framework.Failf("Error creating metrics grabber : %v", err) </del> <ins> framework.ExpectNoError(err, "Error creating metrics grabber: %v", err) </ins> } if !metricsGrabber.HasRegisteredMaster() { <del> framework.Skipf("Environment does not support getting controller-manager metrics - skipping") </del> <ins> e2elog.Logf("Warning: Environment does not support getting controller-manager metrics") return opCounts{} </ins> } controllerMetrics, err := metricsGrabber.GrabFromControllerManager()
// Now do the more expensive test initialization. l.config, l.testCleanup = driver.PrepareTest(f) <ins> l.intreeOps, l.migratedOps = getMigrationVolumeOpCounts(f.ClientSet, dInfo.InTreePluginName) </ins> l.resource = createGenericVolumeTestResource(driver, l.config, pattern) if l.resource.volSource == nil { framework.Skipf("Driver %q does not define volumeSource - skipping", dInfo.Name) } <del> l.intreeOps, l.migratedOps = getMigrationVolumeOpCounts(f.ClientSet, dInfo.InTreePluginName) </del> } cleanup := func() {