Merge branch '15106-trgm-text-search'
[arvados.git] / lib / controller / handler_test.go
index dfe60d90a5f3119909658149b1017f3b782515f3..9b0ff2764be620bd847dc03c2da2f0848b008f07 100644 (file)
@@ -42,21 +42,36 @@ func (s *HandlerSuite) SetUpTest(c *check.C) {
        s.cluster = &arvados.Cluster{
                ClusterID:  "zzzzz",
                PostgreSQL: integrationTestCluster().PostgreSQL,
-               NodeProfiles: map[string]arvados.NodeProfile{
-                       "*": {
-                               Controller: arvados.SystemServiceInstance{Listen: ":"},
-                               RailsAPI:   arvados.SystemServiceInstance{Listen: os.Getenv("ARVADOS_TEST_API_HOST"), TLS: true, Insecure: true},
-                       },
-               },
        }
-       node := s.cluster.NodeProfiles["*"]
-       s.handler = newHandler(s.ctx, s.cluster, &node)
+       s.cluster.TLS.Insecure = true
+       arvadostest.SetServiceURL(&s.cluster.Services.RailsAPI, "https://"+os.Getenv("ARVADOS_TEST_API_HOST"))
+       arvadostest.SetServiceURL(&s.cluster.Services.Controller, "http://localhost:/")
+       s.handler = newHandler(s.ctx, s.cluster, "")
 }
 
 func (s *HandlerSuite) TearDownTest(c *check.C) {
        s.cancel()
 }
 
+func (s *HandlerSuite) TestConfigExport(c *check.C) {
+       s.cluster.ManagementToken = "secret"
+       s.cluster.SystemRootToken = "secret"
+       s.cluster.Collections.BlobSigning = true
+       s.cluster.Collections.BlobSigningTTL = arvados.Duration(23 * time.Second)
+       req := httptest.NewRequest("GET", "/arvados/v1/config", nil)
+       resp := httptest.NewRecorder()
+       s.handler.ServeHTTP(resp, req)
+       c.Check(resp.Code, check.Equals, http.StatusOK)
+       var cluster arvados.Cluster
+       c.Log(resp.Body.String())
+       err := json.Unmarshal(resp.Body.Bytes(), &cluster)
+       c.Check(err, check.IsNil)
+       c.Check(cluster.ManagementToken, check.Equals, "")
+       c.Check(cluster.SystemRootToken, check.Equals, "")
+       c.Check(cluster.Collections.BlobSigning, check.DeepEquals, true)
+       c.Check(cluster.Collections.BlobSigningTTL, check.Equals, arvados.Duration(23*time.Second))
+}
+
 func (s *HandlerSuite) TestProxyDiscoveryDoc(c *check.C) {
        req := httptest.NewRequest("GET", "/discovery/v1/apis/arvados/v1/rest", nil)
        resp := httptest.NewRecorder()
@@ -72,7 +87,7 @@ func (s *HandlerSuite) TestProxyDiscoveryDoc(c *check.C) {
 }
 
 func (s *HandlerSuite) TestRequestTimeout(c *check.C) {
-       s.cluster.HTTPRequestTimeout = arvados.Duration(time.Nanosecond)
+       s.cluster.API.RequestTimeout = arvados.Duration(time.Nanosecond)
        req := httptest.NewRequest("GET", "/discovery/v1/apis/arvados/v1/rest", nil)
        resp := httptest.NewRecorder()
        s.handler.ServeHTTP(resp, req)