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:
Patrick Ohly 2024-08-23 14:27:26 +02:00
parent 5447d28c0d
commit 6cbdef850c

View File

@ -18,6 +18,7 @@ package framework
import (
"context"
"fmt"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
@ -109,20 +110,19 @@ func (p *IntegrationTestNodePreparer) PrepareNodes(ctx context.Context, nextNode
}
}
if err != nil {
klog.Fatalf("Error creating node: %v", err)
return fmt.Errorf("creating node: %w", err)
}
}
nodes, err := waitListAllNodes(p.client)
if err != nil {
klog.Fatalf("Error listing nodes: %v", err)
return fmt.Errorf("listing nodes: %w", err)
}
index := nextNodeIndex
for _, v := range p.countToStrategy {
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 {
klog.Errorf("Aborting node preparation: %v", err)
return err
return fmt.Errorf("aborting node preparation: %w", err)
}
}
}