This is an automated email from the ASF dual-hosted git repository.

chia7712 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/yunikorn-core.git


The following commit(s) were added to refs/heads/master by this push:
     new 2fa897cb [YUNIKORN-2302] TestNoFillWithoutEventPluginRegistered is 
flaky (#767)
2fa897cb is described below

commit 2fa897cb51a4b92723bcf0a7c2c1b5f259c9ea68
Author: pbacsko <[email protected]>
AuthorDate: Tue Jan 2 19:23:19 2024 +0100

    [YUNIKORN-2302] TestNoFillWithoutEventPluginRegistered is flaky (#767)
    
    Reviewers: Chia-Ping Tsai <[email protected]>
---
 pkg/events/event_publisher_test.go | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/pkg/events/event_publisher_test.go 
b/pkg/events/event_publisher_test.go
index 2f223d98..88d2b259 100644
--- a/pkg/events/event_publisher_test.go
+++ b/pkg/events/event_publisher_test.go
@@ -88,11 +88,9 @@ func TestServiceStartStopInternal(t *testing.T) {
 }
 
 func TestNoFillWithoutEventPluginRegistered(t *testing.T) {
-       pushEventInterval := 2 * time.Millisecond
-
        store := newEventStore()
        publisher := CreateShimPublisher(store)
-       publisher.pushEventInterval = pushEventInterval
+       publisher.pushEventInterval = time.Millisecond
        publisher.StartService()
        defer publisher.Stop()
 
@@ -104,9 +102,11 @@ func TestNoFillWithoutEventPluginRegistered(t *testing.T) {
                TimestampNano: 123456,
        }
        store.Store(event)
-       time.Sleep(2 * pushEventInterval)
-       assert.Equal(t, store.CountStoredEvents(), 0,
-               "the Publisher should erase the store even if no EventPlugin 
registered")
+
+       err := common.WaitForCondition(func() bool {
+               return store.CountStoredEvents() == 0
+       }, time.Millisecond, time.Second)
+       assert.NilError(t, err, "the Publisher should erase the store even if 
no EventPlugin registered")
 }
 
 // we push an event to the publisher, and check that the same event


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to