mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-13 13:55:41 +00:00
scheduler_perf: normal error handling during node creation
Calling klog.Fatalf is not a good way to report problems. It kills the entire test run, without given other code a chance to react.
This commit is contained in:
parent
5447d28c0d
commit
6cbdef850c
@ -18,6 +18,7 @@ package framework
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/api/resource"
|
"k8s.io/apimachinery/pkg/api/resource"
|
||||||
@ -109,20 +110,19 @@ func (p *IntegrationTestNodePreparer) PrepareNodes(ctx context.Context, nextNode
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.Fatalf("Error creating node: %v", err)
|
return fmt.Errorf("creating node: %w", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nodes, err := waitListAllNodes(p.client)
|
nodes, err := waitListAllNodes(p.client)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.Fatalf("Error listing nodes: %v", err)
|
return fmt.Errorf("listing nodes: %w", err)
|
||||||
}
|
}
|
||||||
index := nextNodeIndex
|
index := nextNodeIndex
|
||||||
for _, v := range p.countToStrategy {
|
for _, v := range p.countToStrategy {
|
||||||
for i := 0; i < v.Count; i, index = i+1, index+1 {
|
for i := 0; i < v.Count; i, index = i+1, index+1 {
|
||||||
if err := testutils.DoPrepareNode(ctx, p.client, &nodes.Items[index], v.Strategy); err != nil {
|
if err := testutils.DoPrepareNode(ctx, p.client, &nodes.Items[index], v.Strategy); err != nil {
|
||||||
klog.Errorf("Aborting node preparation: %v", err)
|
return fmt.Errorf("aborting node preparation: %w", err)
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user