chia7712 commented on code in PR #875:
URL: https://github.com/apache/yunikorn-core/pull/875#discussion_r1628033501


##########
pkg/common/utils_test.go:
##########
@@ -234,36 +234,28 @@ func TestConvertSITimestamp(t *testing.T) {
        assert.Equal(t, result, time.Time{})
 }
 
-func TestWaitFor(t *testing.T) {
-       var tests = []struct {
-               testname   string
-               bound      int
-               ErrorExist bool
+func TestWaitForCondition(t *testing.T) {
+       target := false
+       eval := func() bool {
+               return target
+       }
+       tests := []struct {
+               input    bool
+               interval time.Duration
+               timeout  time.Duration
+               output   error
        }{
-               {"Timeout case", 10000, true},
-               {"Fullfilling case", 10, false},
+               {true, time.Duration(1) * time.Second, time.Duration(2) * 
time.Second, nil},
+               {false, time.Duration(1) * time.Second, time.Duration(2) * 
time.Second, ErrorTimeout},

Review Comment:
   Could you please add test for "interval > timeout"? It should call `eval` 
only once



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to