mirror of
https://github.com/akvorado/akvorado.git
synced 2025-12-12 06:24:10 +01:00
common/kafka: don't try to fiddle with brokers
Assume that if we can refresh metadata we are OK.
This commit is contained in:
@@ -32,7 +32,6 @@ func SetupKafkaBroker(t *testing.T) (sarama.Client, []string) {
|
|||||||
for i := 0; i < 90 && !ready; i++ {
|
for i := 0; i < 90 && !ready; i++ {
|
||||||
if client != nil {
|
if client != nil {
|
||||||
client.Close()
|
client.Close()
|
||||||
time.Sleep(10 * time.Millisecond)
|
|
||||||
}
|
}
|
||||||
if client, err = sarama.NewClient([]string{broker}, saramaConfig); err != nil {
|
if client, err = sarama.NewClient([]string{broker}, saramaConfig); err != nil {
|
||||||
continue
|
continue
|
||||||
@@ -44,13 +43,7 @@ func SetupKafkaBroker(t *testing.T) (sarama.Client, []string) {
|
|||||||
if len(brokers) == 0 {
|
if len(brokers) == 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if err := brokers[0].Open(client.Config()); err != nil {
|
ready = true
|
||||||
continue
|
|
||||||
}
|
|
||||||
if connected, err := brokers[0].Connected(); err == nil && connected {
|
|
||||||
ready = true
|
|
||||||
}
|
|
||||||
brokers[0].Close()
|
|
||||||
}
|
}
|
||||||
if !ready {
|
if !ready {
|
||||||
t.Fatalf("broker is not ready")
|
t.Fatalf("broker is not ready")
|
||||||
|
|||||||
Reference in New Issue
Block a user