21700: Install Bundler system-wide in Rails postinst
[arvados.git] / sdk / go / arvadostest / db.go
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: Apache-2.0
4
5 package arvadostest
6
7 import (
8         "git.arvados.org/arvados.git/sdk/go/arvados"
9         "github.com/jmoiron/sqlx"
10
11         // sqlx needs lib/pq to talk to PostgreSQL
12         _ "github.com/lib/pq"
13         "gopkg.in/check.v1"
14 )
15
16 // DB returns a DB connection for the given cluster config.
17 func DB(c *check.C, cluster *arvados.Cluster) *sqlx.DB {
18         db, err := sqlx.Open("postgres", cluster.PostgreSQL.Connection.String())
19         c.Assert(err, check.IsNil)
20         return db
21 }