pbacsko commented on code in PR #1052:
URL: https://github.com/apache/yunikorn-k8shim/pull/1052#discussion_r3693193340
##########
pkg/cache/context.go:
##########
@@ -884,6 +888,13 @@ func (ctx *Context) AssumePod(name, node string) error {
return nil
}
+func (ctx *Context) assumePodShouldInjectError() bool {
+ clientSet := ctx.apiProvider.GetAPIs().KubeClient.GetClientSet()
+ _, err := clientSet.CoreV1().ConfigMaps(ctx.namespace).Get(
+ context.TODO(), constants.FaultInjectConfigMapName,
metav1.GetOptions{})
+ return err == nil
+}
+
Review Comment:
We shouldn't be doing this just for the sake of a simulated `AssumePod()`
failure. It just adds extra complexity and noise to the production code. Also,
writing and maintaining such e2e tests are more difficult.
There are `MockScheduler`-based tests exactly for this purpose. It's very
easy to simulate errors with the mocks and these tests are essentially run the
whole scheduler without a real K8s cluster. Much easier to run, validate and
debug. In fact, `TestAssumePodError()` is already there - just add the new
assertions. Add new test cases separately if needed.
--
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]