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