pbacsko commented on code in PR #525:
URL: https://github.com/apache/yunikorn-k8shim/pull/525#discussion_r1116036870
##########
test/e2e/framework/helpers/yunikorn/rest_api_utils.go:
##########
@@ -106,6 +106,51 @@ func (c *RClient) GetHealthCheck()
(dao.SchedulerHealthDAOInfo, error) {
return healthCheck, err
}
+func (c *RClient) WaitforQueueToAppear(partition string, queueName string,
timeout int) error {
+ var queueInfo = wait.PollImmediate(300*time.Millisecond,
time.Duration(timeout)*time.Second, c.IsQueuePresent(partition, queueName))
+ startTime := time.Now().Unix()
+ endTime := startTime + int64(timeout)
+ // if the queue is not present , Polling for timeout seconds
+ for {
+ currentTime := time.Now().Unix()
+ if queueInfo != nil {
+ if currentTime <= endTime {
+ queueInfo =
wait.PollImmediate(300*time.Millisecond, time.Duration(timeout)*time.Second,
c.IsQueuePresent(partition, queueName))
+ } else {
+ break
+ }
+ } else {
+ break
+ }
+ }
Review Comment:
To me, this part is very unclear. We already do multiple calls inside
`PollImmediate()`, why do we do it again in a for loop? It's very confusing,
especially the nesting.
Also, "queueInfo" is an error object, can't we just call it "err"?
--
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]