Skip to content

Commit b871820

Browse files
authored
test: make health-checker quieter (#8671)
Instead of logging each check, log final failures. Also, if a service is slow to become healthy, log that. Right now, the `boulder-ra-sct-provider` instances take about 5s to become healthy in our CI runs, and health-checker spams the logs a lot during that period. We should improve the startup time, but this is a quick fix to reduce the log spam.
1 parent 00dd199 commit b871820

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

test/health-checker/main.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ func main() {
5959
ctx, cancel := context.WithTimeout(context.Background(), 10*c.GRPC.Timeout.Duration)
6060
defer cancel()
6161

62-
for {
62+
start := time.Now()
63+
for i := 1; ; i++ {
6364
select {
6465
case <-ticker.C:
6566
_, hostOverride, err := c.GRPC.MakeTargetAndHostOverride()
@@ -84,8 +85,11 @@ func main() {
8485
if strings.Contains(err.Error(), "authentication handshake failed") {
8586
cmd.Fail(fmt.Sprintf("health checking %s (%s): %s\n", c.GRPC.HostOverride, *serverAddr, err))
8687
}
87-
fmt.Fprintf(os.Stderr, "health checking %s (%s): %s\n", c.GRPC.HostOverride, *serverAddr, err)
8888
} else if resp.Status == healthpb.HealthCheckResponse_SERVING {
89+
elapsed := time.Since(start)
90+
if elapsed > 1*time.Second {
91+
fmt.Printf("service %s is healthy after %s with %d tries\n", *serverAddr, elapsed, i)
92+
}
8993
return
9094
} else {
9195
cmd.Fail(fmt.Sprintf("service %s failed health check with status %s", *serverAddr, resp.Status))

0 commit comments

Comments
 (0)