chenyulin0719 commented on code in PR #879:
URL: https://github.com/apache/yunikorn-k8shim/pull/879#discussion_r1683739952


##########
pkg/common/utils/utils_test.go:
##########
@@ -1140,3 +1211,30 @@ func TestConvert2PriorityClass(t *testing.T) {
        assert.Assert(t, result != nil)
        assert.Equal(t, result.PreemptionPolicy, &preemptLower)
 }
+
+func TestWaitForCondition(t *testing.T) {
+       target := false
+       eval := func() bool {
+               return target
+       }
+       tests := []struct {
+               input    bool
+               interval time.Duration
+               timeout  time.Duration
+               output   error
+       }{
+               {true, time.Duration(1) * time.Second, time.Duration(2) * 
time.Second, nil},
+               {false, time.Duration(1) * time.Second, time.Duration(2) * 
time.Second, ErrorTimeout},
+               {true, time.Duration(3) * time.Second, time.Duration(2) * 
time.Second, nil},
+               {false, time.Duration(3) * time.Second, time.Duration(2) * 
time.Second, ErrorTimeout},
+       }
+       for _, test := range tests {
+               target = test.input
+               get := WaitForCondition(eval, test.timeout, test.interval)
+               if test.output == nil {
+                       assert.NilError(t, get)
+               } else {
+                       assert.Equal(t, get.Error(), test.output.Error())
+               }
+       }
+}

Review Comment:
   OK, let's keep the test cases consistent with core.



-- 
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