Skip to content

Commit

Permalink
fix: mute until success
Browse files Browse the repository at this point in the history
  • Loading branch information
astromechza committed Sep 5, 2024
1 parent 2a5cfa7 commit 6454487
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,13 @@ func waitForHealthyAmqp(t *testing.T, connStr string) *Conn {
defer cancel()
tkr := time.NewTicker(time.Second)

// only log connection-level logs when verbose is enabled
connLogger := simpleLogF(func(s string, i ...interface{}) {})
if testing.Verbose() {
connLogger = simpleLogF(t.Logf)
}
// only log connection-level logs when connection has succeeded
muted := true
connLogger := simpleLogF(func(s string, i ...interface{}) {
if !muted {
t.Logf(s, i...)
}
})

var lastErr error
for {
Expand All @@ -71,6 +73,7 @@ func waitForHealthyAmqp(t *testing.T, connStr string) *Conn {
t.Log("publish ping failed", err.Error())
} else {
t.Log("ping successful")
muted = true
return conn
}
}
Expand Down

0 comments on commit 6454487

Please sign in to comment.