UT: Increase unit test coverage of pkg/bootstrap (#101)

Signed-off-by: charlie <qianglin98@qq.com>
This commit is contained in:
charlie
2023-01-14 14:50:15 +08:00
committed by GitHub
parent 926f858a13
commit 616b37a268
5 changed files with 76 additions and 7 deletions

View File

@@ -229,7 +229,9 @@ func (s *Server) initConfigController() error {
// Defer starting the controller until after the service is created.
s.server.RunComponent(func(stop <-chan struct{}) error {
ingressConfig.InitializeCluster(ingressController, stop)
if err := ingressConfig.InitializeCluster(ingressController, stop); err != nil {
return err
}
go s.configController.Run(stop)
return nil
})
@@ -322,8 +324,7 @@ func (s *Server) initXdsServer() error {
s.xdsServer.Start(stop)
return nil
})
s.initGrpcServer()
return nil
return s.initGrpcServer()
}
func (s *Server) initGrpcServer() error {
@@ -381,6 +382,7 @@ func (s *Server) initHttpServer() error {
return nil
}
// readyHandler checks whether the http server is ready
func (s *Server) readyHandler(w http.ResponseWriter, _ *http.Request) {
for name, fn := range s.readinessProbes {
if ready, err := fn(); !ready {
@@ -394,10 +396,7 @@ func (s *Server) readyHandler(w http.ResponseWriter, _ *http.Request) {
// cachesSynced checks whether caches have been synced.
func (s *Server) cachesSynced() bool {
if !s.configController.HasSynced() {
return false
}
return true
return s.configController.HasSynced()
}
func (s *Server) waitForCacheSync(stop <-chan struct{}) bool {