Skip to content

Commit

Permalink
fix: flaky e2e test cases (#2102)
Browse files Browse the repository at this point in the history
* fix: flaky e2e test cases

Signed-off-by: Derek Wang <whynowy@gmail.com>
  • Loading branch information
whynowy committed Jul 25, 2022
1 parent b39d0c1 commit e301b69
Show file tree
Hide file tree
Showing 13 changed files with 159 additions and 163 deletions.
10 changes: 10 additions & 0 deletions test/e2e/fixtures/then.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"testing"
"time"

apierr "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -42,6 +43,15 @@ func (t *Then) ExpectEventBusDeleted() *Then {
return t
}

func (t *Then) ExpectNoSensorPodFound() *Then {
ctx := context.Background()
labelSelector := fmt.Sprintf("controller=sensor-controller,sensor-name=%s", t.sensor.Name)
if err := testutil.WaitForNoPodFound(ctx, t.kubeClient, Namespace, labelSelector, 20*time.Second); err != nil {
t.t.Fatalf("expected no sensor pod found: %v", err)
}
return t
}

// look for regex match in Sensor pod's log
// if countOpt != nil, look for specific count of regex match; else look for at least one instance
func (t *Then) ExpectEventSourcePodLogContains(regex string, options ...testutil.PodLogCheckOption) *Then {
Expand Down

0 comments on commit e301b69

Please sign in to comment.