Skip to content

Commit

Permalink
Increase kafka timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
jotak committed Nov 23, 2023
1 parent 1b6d879 commit d86249f
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions e2e/kafka/kafka_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@
package basic

import (
"context"
"fmt"
"path"
"strings"
"testing"
"time"

"github.com/netobserv/netobserv-ebpf-agent/e2e/basic"
"github.com/netobserv/netobserv-ebpf-agent/e2e/cluster"

"github.com/sirupsen/logrus"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
Expand Down Expand Up @@ -59,14 +62,24 @@ func TestMain(m *testing.M) {
kfk := Kafka{ObjectMeta: metav1.ObjectMeta{
Namespace: namespace, Name: "kafka-cluster",
}}
var pods corev1.PodList
err = cfg.Client().Resources().List(context.TODO(), &pods)
if err != nil {
return fmt.Errorf("can't list pods: %w", err)
}
podsInfo := []string{}
for _, p := range pods.Items {
podsInfo = append(podsInfo, p.Name+"/"+string(p.Status.Phase)+"/"+p.Status.Message)
}
klog.Infof("Debug Info: " + strings.Join(podsInfo, " ,,,,, "))
if err := wait.For(conditions.New(client.Resources()).
ResourceMatch(&kfk, func(object k8s.Object) bool {
kafka, ok := object.(*Kafka)
if !ok {
return false
}
return kafka.Status.Ready()
}), wait.WithTimeout(time.Second*10)); err != nil {
}), wait.WithTimeout(time.Minute*1)); err != nil {
return fmt.Errorf("waiting for kafka cluster to be ready: %w", err)
}
return nil
Expand Down Expand Up @@ -118,14 +131,14 @@ func (ks *KafkaStatus) Ready() bool {
if ks == nil {
return false
}
klog.Debugf("Kafka len of conditions: %d", len(ks.Conditions))
klog.Infof("Kafka len of conditions: %d", len(ks.Conditions))
for _, cond := range ks.Conditions {
klog.WithFields(logrus.Fields{
"reason": cond.Reason,
"msg": cond.Message,
"type": cond.Type,
"status": cond.Status,
}).Debug("Waiting for kafka to be up and running")
}).Info("Waiting for kafka to be up and running")
if cond.Type == conditionReady {
return cond.Status == metav1.ConditionTrue
}
Expand Down

0 comments on commit d86249f

Please sign in to comment.