Skip to content

Commit 49b788d

Browse files
committed
fixup: Respond to review feedback
1 parent 7da8fdd commit 49b788d

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

tests/fixture/bootstrapmonitor/e2e/e2e_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@ var _ = ginkgo.Describe("[Bootstrap Tester]", func() {
158158
if !strings.Contains(testConfig.Image, "sha256") {
159159
return false
160160
}
161-
162161
containerImage = testConfig.Image
163162
return true
164163
}, e2e.DefaultTimeout, e2e.DefaultPollingInterval)

tests/fixture/tmpnet/utils.go

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package tmpnet
66
import (
77
"context"
88
"encoding/json"
9+
"errors"
910
"fmt"
1011
"net"
1112
"syscall"
@@ -20,6 +21,8 @@ const (
2021
DefaultNodeTickerInterval = 50 * time.Millisecond
2122
)
2223

24+
var ErrUnrecoverableNodeHealthCheck = errors.New("failed to query node health")
25+
2326
func CheckNodeHealth(ctx context.Context, uri string) (*health.APIReply, error) {
2427
// Check that the node is reporting healthy
2528
healthReply, err := health.NewClient(uri).Health(ctx, nil)
@@ -31,16 +34,16 @@ func CheckNodeHealth(ctx context.Context, uri string) (*health.APIReply, error)
3134
case *net.OpError:
3235
if t.Op == "read" {
3336
// Connection refused - potentially recoverable
34-
return nil, nil
37+
return nil, err
3538
}
3639
case syscall.Errno:
3740
if t == syscall.ECONNREFUSED {
3841
// Connection refused - potentially recoverable
39-
return nil, nil
42+
return nil, err
4043
}
4144
}
4245
// Assume all other errors are not recoverable
43-
return nil, fmt.Errorf("failed to query node health: %w", err)
46+
return nil, fmt.Errorf("%w: %w", ErrUnrecoverableNodeHealthCheck, err)
4447
}
4548

4649
// WaitForHealthy blocks until Node.IsHealthy returns true or an error (including context timeout) is observed.
@@ -53,10 +56,14 @@ func WaitForHealthy(ctx context.Context, node *Node) error {
5356

5457
for {
5558
healthy, err := node.IsHealthy(ctx)
56-
if err != nil {
57-
return fmt.Errorf("failed to wait for health of node %q: %w", node.NodeID, err)
58-
}
59-
if healthy {
59+
switch {
60+
case errors.Is(err, ErrUnrecoverableNodeHealthCheck):
61+
return fmt.Errorf("%w for node %q", err, node.NodeID)
62+
case err != nil:
63+
// Error is recoverable
64+
// TODO(marun) Log the error to aid in troubleshooting once a logger is available
65+
continue
66+
case healthy:
6067
return nil
6168
}
6269

0 commit comments

Comments
 (0)