wilfred-s commented on code in PR #950:
URL: https://github.com/apache/yunikorn-k8shim/pull/950#discussion_r1952024952


##########
pkg/client/apifactory_mock.go:
##########
@@ -398,11 +398,21 @@ func (m *MockedAPIProvider) UpdatePriorityClass(oldObj 
*schedv1.PriorityClass, n
 }
 
 func (m *MockedAPIProvider) GetPodBindStats() BindStats {
-       return m.clients.KubeClient.(*KubeClientMock).GetBindStats()
+       client, ok := m.clients.KubeClient.(*KubeClientMock)
+       if !ok {
+               log.Log(log.Test).Error("failed to get KubeClientMock")
+               return BindStats{}
+       }

Review Comment:
   It would be far nicer to just return a nil and let the caller handle it. We 
finally end up here in `BenchmarkSchedulingThroughPut`:
   ```
        stat := cluster.GetPodBindStats()
        diff := stat.Last.Sub(stat.First)
        fmt.Printf("Overall throughput: %.0f allocations/s\n", 
float64(totalPods)/diff.Seconds())
   ```
   Handle the nil there and still print the metrics just after it as the run 
has finished.



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