Skip to content

Commit 41577de

Browse files
committed
delete opIndex wrapping
1 parent 2c06211 commit 41577de

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

test/integration/scheduler_perf/scheduler_perf.go

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1574,10 +1574,10 @@ func (e *WorkloadExecutor) runOp(op realOp, opIndex int) error {
15741574
func (e *WorkloadExecutor) runCreateNodesOp(opIndex int, op *createNodesOp) error {
15751575
nodePreparer, err := getNodePreparer(fmt.Sprintf("node-%d-", opIndex), op, e.tCtx.Client())
15761576
if err != nil {
1577-
return fmt.Errorf("op %d: %w", opIndex, err)
1577+
return err
15781578
}
15791579
if err := nodePreparer.PrepareNodes(e.tCtx, e.nextNodeIndex); err != nil {
1580-
return fmt.Errorf("op %d: %w", opIndex, err)
1580+
return err
15811581
}
15821582
e.nextNodeIndex += op.Count
15831583
return nil
@@ -1586,14 +1586,14 @@ func (e *WorkloadExecutor) runCreateNodesOp(opIndex int, op *createNodesOp) erro
15861586
func (e *WorkloadExecutor) runCreateNamespaceOp(opIndex int, op *createNamespacesOp) error {
15871587
nsPreparer, err := newNamespacePreparer(e.tCtx, op)
15881588
if err != nil {
1589-
return fmt.Errorf("op %d: %w", opIndex, err)
1589+
return err
15901590
}
15911591
if err := nsPreparer.prepare(e.tCtx); err != nil {
15921592
err2 := nsPreparer.cleanup(e.tCtx)
15931593
if err2 != nil {
15941594
err = fmt.Errorf("prepare: %w; cleanup: %w", err, err2)
15951595
}
1596-
return fmt.Errorf("op %d: %w", opIndex, err)
1596+
return err
15971597
}
15981598
for _, n := range nsPreparer.namespaces() {
15991599
if _, ok := e.numPodsScheduledPerNamespace[n]; ok {
@@ -1608,20 +1608,20 @@ func (e *WorkloadExecutor) runCreateNamespaceOp(opIndex int, op *createNamespace
16081608
func (e *WorkloadExecutor) runBarrierOp(opIndex int, op *barrierOp) error {
16091609
for _, namespace := range op.Namespaces {
16101610
if _, ok := e.numPodsScheduledPerNamespace[namespace]; !ok {
1611-
return fmt.Errorf("op %d: unknown namespace %s", opIndex, namespace)
1611+
return fmt.Errorf("unknown namespace %s", namespace)
16121612
}
16131613
}
16141614
switch op.StageRequirement {
16151615
case Attempted:
16161616
if err := waitUntilPodsAttempted(e.tCtx, e.podInformer, op.LabelSelector, op.Namespaces, e.numPodsScheduledPerNamespace); err != nil {
1617-
return fmt.Errorf("op %d: %w", opIndex, err)
1617+
return err
16181618
}
16191619
case Scheduled:
16201620
// Default should be treated like "Scheduled", so handling both in the same way.
16211621
fallthrough
16221622
default:
16231623
if err := waitUntilPodsScheduled(e.tCtx, e.podInformer, op.LabelSelector, op.Namespaces, e.numPodsScheduledPerNamespace); err != nil {
1624-
return fmt.Errorf("op %d: %w", opIndex, err)
1624+
return err
16251625
}
16261626
// At the end of the barrier, we can be sure that there are no pods
16271627
// pending scheduling in the namespaces that we just blocked on.
@@ -1670,7 +1670,7 @@ func (e *WorkloadExecutor) runCreatePodsOp(opIndex int, op *createPodsOp) error
16701670

16711671
if op.CollectMetrics {
16721672
if e.collectorCtx != nil {
1673-
return fmt.Errorf("op %d: Metrics collection is overlapping. Probably second collector was started before stopping a previous one", opIndex)
1673+
return fmt.Errorf("Metrics collection is overlapping. Probably second collector was started before stopping a previous one")
16741674
}
16751675
var err error
16761676
e.collectorCtx, e.collectors, err = startCollectingMetrics(e.tCtx, &e.collectorWG, e.podInformer, e.testCase.MetricsCollectorConfig, e.throughputErrorMargin, opIndex, namespace, []string{namespace}, nil)
@@ -1679,7 +1679,7 @@ func (e *WorkloadExecutor) runCreatePodsOp(opIndex int, op *createPodsOp) error
16791679
}
16801680
}
16811681
if err := createPodsRapidly(e.tCtx, namespace, op); err != nil {
1682-
return fmt.Errorf("op %d: %w", opIndex, err)
1682+
return err
16831683
}
16841684
switch {
16851685
case op.SkipWaitToCompletion:
@@ -1688,11 +1688,11 @@ func (e *WorkloadExecutor) runCreatePodsOp(opIndex int, op *createPodsOp) error
16881688
e.numPodsScheduledPerNamespace[namespace] += op.Count
16891689
case op.SteadyState:
16901690
if err := createPodsSteadily(e.tCtx, namespace, e.podInformer, op); err != nil {
1691-
return fmt.Errorf("op %d: %w", opIndex, err)
1691+
return err
16921692
}
16931693
default:
16941694
if err := waitUntilPodsScheduledInNamespace(e.tCtx, e.podInformer, nil, namespace, op.Count); err != nil {
1695-
return fmt.Errorf("op %d: error in waiting for pods to get scheduled: %w", opIndex, err)
1695+
return fmt.Errorf("error in waiting for pods to get scheduled: %w", err)
16961696
}
16971697
}
16981698
if op.CollectMetrics {
@@ -1714,7 +1714,7 @@ func (e *WorkloadExecutor) runDeletePodsOp(opIndex int, op *deletePodsOp) error
17141714

17151715
podsToDelete, err := e.podInformer.Lister().Pods(op.Namespace).List(labelSelector)
17161716
if err != nil {
1717-
return fmt.Errorf("op %d: error in listing pods in the namespace %s: %w", opIndex, op.Namespace, err)
1717+
return fmt.Errorf("error in listing pods in the namespace %s: %w", op.Namespace, err)
17181718
}
17191719

17201720
deletePods := func(opIndex int) {
@@ -1771,20 +1771,20 @@ func (e *WorkloadExecutor) runChurnOp(opIndex int, op *churnOp) error {
17711771
// Ensure the namespace exists.
17721772
nsObj := &v1.Namespace{ObjectMeta: metav1.ObjectMeta{Name: namespace}}
17731773
if _, err := e.tCtx.Client().CoreV1().Namespaces().Create(e.tCtx, nsObj, metav1.CreateOptions{}); err != nil && !apierrors.IsAlreadyExists(err) {
1774-
return fmt.Errorf("op %d: unable to create namespace %v: %w", opIndex, namespace, err)
1774+
return fmt.Errorf("unable to create namespace %v: %w", namespace, err)
17751775
}
17761776

17771777
var churnFns []func(name string) string
17781778

17791779
for i, path := range op.TemplatePaths {
17801780
unstructuredObj, gvk, err := getUnstructuredFromFile(path)
17811781
if err != nil {
1782-
return fmt.Errorf("op %d: unable to parse the %v-th template path: %w", opIndex, i, err)
1782+
return fmt.Errorf("unable to parse the %v-th template path: %w", i, err)
17831783
}
17841784
// Obtain GVR.
17851785
mapping, err := restMapper.RESTMapping(gvk.GroupKind(), gvk.Version)
17861786
if err != nil {
1787-
return fmt.Errorf("op %d: unable to find GVR for %v: %w", opIndex, gvk, err)
1787+
return fmt.Errorf("unable to find GVR for %v: %w", gvk, err)
17881788
}
17891789
gvr := mapping.Resource
17901790
// Distinguish cluster-scoped with namespaced API objects.
@@ -1870,7 +1870,7 @@ func (e *WorkloadExecutor) runChurnOp(opIndex int, op *churnOp) error {
18701870
func (e *WorkloadExecutor) runDefaultOp(opIndex int, op realOp) error {
18711871
runable, ok := op.(runnableOp)
18721872
if !ok {
1873-
return fmt.Errorf("op %d: invalid op %v", opIndex, op)
1873+
return fmt.Errorf("invalid op %v", op)
18741874
}
18751875
for _, namespace := range runable.requiredNamespaces() {
18761876
err := createNamespaceIfNotPresent(e.tCtx, namespace, &e.numPodsScheduledPerNamespace)
@@ -1884,7 +1884,7 @@ func (e *WorkloadExecutor) runDefaultOp(opIndex int, op realOp) error {
18841884

18851885
func (e *WorkloadExecutor) runStartCollectingMetricsOp(opIndex int, op *startCollectingMetricsOp) error {
18861886
if e.collectorCtx != nil {
1887-
return fmt.Errorf("op %d: Metrics collection is overlapping. Probably second collector was started before stopping a previous one", opIndex)
1887+
return fmt.Errorf("Metrics collection is overlapping. Probably second collector was started before stopping a previous one")
18881888
}
18891889
var err error
18901890
e.collectorCtx, e.collectors, err = startCollectingMetrics(e.tCtx, &e.collectorWG, e.podInformer, e.testCase.MetricsCollectorConfig, e.throughputErrorMargin, opIndex, op.Name, op.Namespaces, op.LabelSelector)

0 commit comments

Comments
 (0)