Chia-Ping Tsai created YUNIKORN-2625: ----------------------------------------
Summary: Refactor Clients to avoid hard-code checks Key: YUNIKORN-2625 URL: https://issues.apache.org/jira/browse/YUNIKORN-2625 Project: Apache YuniKorn Issue Type: Improvement Reporter: Chia-Ping Tsai {code:java} if c.NodeInformer.Informer().HasSynced() && c.PodInformer.Informer().HasSynced() && c.PVCInformer.Informer().HasSynced() && c.PVInformer.Informer().HasSynced() && c.StorageInformer.Informer().HasSynced() && c.CSINodeInformer.Informer().HasSynced() && c.ConfigMapInformer.Informer().HasSynced() && c.NamespaceInformer.Informer().HasSynced() && c.PriorityClassInformer.Informer().HasSynced() { return } {code} {code:java} go c.NodeInformer.Informer().Run(stopCh) go c.PodInformer.Informer().Run(stopCh) go c.PVInformer.Informer().Run(stopCh) go c.PVCInformer.Informer().Run(stopCh) go c.StorageInformer.Informer().Run(stopCh) go c.CSINodeInformer.Informer().Run(stopCh) go c.ConfigMapInformer.Informer().Run(stopCh) go c.NamespaceInformer.Informer().Run(stopCh) go c.PriorityClassInformer.Informer().Run(stopCh) {code} Instead of listing all informer manually, we should add a method to `Clients` to list all informers and then loop all of them. That can bring two benefits. # more readable # easy to write tests. We can override the `informers` method to return mock informer # avoid error-prone (we could miss one of informers in adding more helper methods in the future) -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@yunikorn.apache.org For additional commands, e-mail: dev-h...@yunikorn.apache.org