1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
12 "git.curoverse.com/arvados.git/sdk/go/arvados"
13 "git.curoverse.com/arvados.git/sdk/go/httpserver"
14 "github.com/Sirupsen/logrus"
15 check "gopkg.in/check.v1"
18 // logWriter is an io.Writer that writes by calling a "write log"
19 // function, typically (*check.C)Log().
20 type logWriter struct {
21 logfunc func(...interface{})
24 func (tl *logWriter) Write(buf []byte) (int, error) {
25 tl.logfunc(string(buf))
29 // Return a new unstarted controller server, using the Rails API
30 // provided by the integration-testing environment.
31 func newServerFromIntegrationTestEnv(c *check.C) *httpserver.Server {
33 log.Formatter = &logrus.JSONFormatter{}
34 log.Out = &logWriter{c.Log}
36 nodeProfile := arvados.NodeProfile{
37 Controller: arvados.SystemServiceInstance{Listen: ":"},
38 RailsAPI: arvados.SystemServiceInstance{Listen: os.Getenv("ARVADOS_TEST_API_HOST"), TLS: true, Insecure: true},
40 handler := &Handler{Cluster: &arvados.Cluster{
42 NodeProfiles: map[string]arvados.NodeProfile{
45 }, NodeProfile: &nodeProfile}
47 srv := &httpserver.Server{
49 Handler: httpserver.AddRequestIDs(httpserver.LogRequests(log, handler)),
51 Addr: nodeProfile.Controller.Listen,