pbacsko commented on code in PR #438:
URL: https://github.com/apache/yunikorn-k8shim/pull/438#discussion_r915753673


##########
test/e2e/framework/helpers/k8s/k8s_utils.go:
##########
@@ -442,6 +442,27 @@ func (k *KubeCtl) isPodNotInNS(podName string, namespace 
string) wait.ConditionF
        }
 }
 
+// return a condition function that indicates whether the given pod has 
received the expected event
+func (k *KubeCtl) isPodEventTriggered(namespace string, podName string, 
expectedReason string) wait.ConditionFunc {
+       return func() (bool, error) {
+               events, err := 
k.clientSet.CoreV1().Events(namespace).List(context.TODO(), 
metav1.ListOptions{})
+               if err == nil {

Review Comment:
   Not exactly duplicate, the first is `false, err`:
   
   ```
        return func() (bool, error) {
                events, err := 
k.clientSet.CoreV1().Events(namespace).List(context.TODO(), 
metav1.ListOptions{})
                if err != nil {
                    return false, err
                }
                
                eventItems := events.Items
                for _, event := range eventItems {
                        fmt.Fprintf(ginkgo.GinkgoWriter, "Failed to delete pod 
%s - reason is %s\n", event.InvolvedObject.Name, event.Reason)
                        if event.InvolvedObject.Name == podName && 
strings.Contains(event.Reason, expectedReason) {
                                return true, nil
                        }
                }
                
                return false, nil
        }
   ```



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