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

pbacsko 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 dff8feb6 [YUNIKORN-2167] Flaky test TestApplicationHistoryTracking 
(#722)
dff8feb6 is described below

commit dff8feb690e5794695a4faae51b0d9114c2c972c
Author: PoAn Yang <[email protected]>
AuthorDate: Tue Nov 21 08:49:37 2023 +0100

    [YUNIKORN-2167] Flaky test TestApplicationHistoryTracking (#722)
    
    Signed-off-by: PoAn Yang <[email protected]>
    
    Closes: #722
    
    Signed-off-by: Peter Bacsko <[email protected]>
---
 pkg/scheduler/tests/mockscheduler_test.go | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/pkg/scheduler/tests/mockscheduler_test.go 
b/pkg/scheduler/tests/mockscheduler_test.go
index 125308fd..e5b7bd0e 100644
--- a/pkg/scheduler/tests/mockscheduler_test.go
+++ b/pkg/scheduler/tests/mockscheduler_test.go
@@ -19,6 +19,10 @@
 package tests
 
 import (
+       "fmt"
+       "net"
+       "time"
+
        "github.com/apache/yunikorn-core/pkg/common"
        "github.com/apache/yunikorn-core/pkg/entrypoint"
        "github.com/apache/yunikorn-core/pkg/scheduler"
@@ -55,6 +59,20 @@ func (m *mockScheduler) Init(config string, autoSchedule 
bool, withWebapp bool)
 
        m.mockRM = newMockRMCallbackHandler()
 
+       if withWebapp {
+               err := common.WaitFor(500*time.Millisecond, 2*time.Second, 
func() bool {
+                       conn, err := net.DialTimeout("tcp", 
net.JoinHostPort("127.0.0.1", "9080"), time.Second)
+                       if err == nil {
+                               defer conn.Close()
+                               return true
+                       }
+                       return false
+               })
+               if err != nil {
+                       return fmt.Errorf("webapp failed to start in 2 seconds")
+               }
+       }
+
        _, err := m.proxy.RegisterResourceManager(
                &si.RegisterResourceManagerRequest{
                        RmID:        m.rmID,


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

Reply via email to