17944: Forces vocabulary checking at startup time.
authorLucas Di Pentima <lucas.dipentima@curii.com>
Mon, 1 Nov 2021 20:12:14 +0000 (17:12 -0300)
committerLucas Di Pentima <lucas.dipentima@curii.com>
Tue, 2 Nov 2021 22:34:27 +0000 (19:34 -0300)
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima@curii.com>

lib/controller/handler.go

index 51c72b282214bce660f5cd169cf6532690b00d83..6385913078db526ca1b7629222b9c80fdfcf9663 100644 (file)
@@ -9,6 +9,7 @@ import (
        "errors"
        "fmt"
        "net/http"
+       "net/http/httptest"
        "net/url"
        "strings"
        "sync"
@@ -74,7 +75,21 @@ func (h *Handler) CheckHealth() error {
                return err
        }
        _, _, err = railsproxy.FindRailsAPI(h.Cluster)
-       return err
+       if err != nil {
+               return err
+       }
+       if h.Cluster.API.VocabularyPath != "" {
+               req, err := http.NewRequest("GET", "/arvados/v1/vocabulary", nil)
+               if err != nil {
+                       return err
+               }
+               var resp httptest.ResponseRecorder
+               h.handlerStack.ServeHTTP(&resp, req)
+               if resp.Result().StatusCode != http.StatusOK {
+                       return fmt.Errorf("%d %s", resp.Result().StatusCode, resp.Result().Status)
+               }
+       }
+       return nil
 }
 
 func (h *Handler) Done() <-chan struct{} {