[ARVADOS] created: 2.1.0-20-gefae0f49f

Git user git at public.arvados.org
Thu Oct 22 16:05:50 UTC 2020


        at  efae0f49fb869de889866219912b8c9d6fdb5c59 (commit)


commit efae0f49fb869de889866219912b8c9d6fdb5c59
Author: Tom Clegg <tom at tomclegg.ca>
Date:   Thu Oct 22 12:04:21 2020 -0400

    17014: Test database connection to test cluster.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at tomclegg.ca>

diff --git a/lib/boot/supervisor.go b/lib/boot/supervisor.go
index 3484a1444..90217eabe 100644
--- a/lib/boot/supervisor.go
+++ b/lib/boot/supervisor.go
@@ -59,6 +59,8 @@ type Supervisor struct {
 	environ    []string // for child processes
 }
 
+func (super *Supervisor) Cluster() *arvados.Cluster { return super.cluster }
+
 func (super *Supervisor) Start(ctx context.Context, cfg *arvados.Config, cfgPath string) {
 	super.ctx, super.cancel = context.WithCancel(ctx)
 	super.done = make(chan struct{})
diff --git a/lib/controller/integration_test.go b/lib/controller/integration_test.go
index 077493ffc..cc0b697d4 100644
--- a/lib/controller/integration_test.go
+++ b/lib/controller/integration_test.go
@@ -7,6 +7,7 @@ package controller
 import (
 	"bytes"
 	"context"
+	"database/sql"
 	"encoding/json"
 	"io"
 	"math"
@@ -133,6 +134,19 @@ func (s *IntegrationSuite) SetUpSuite(c *check.C) {
 	}
 }
 
+func (s *IntegrationSuite) TestDatabaseConnection(c *check.C) {
+	ctx, cancel := context.WithCancel(context.Background())
+	defer cancel()
+	db, err := sql.Open("postgres", s.testClusters["z1111"].super.Cluster().PostgreSQL.Connection.String())
+	c.Assert(err, check.IsNil)
+	defer db.Close()
+	conn, err := db.Conn(ctx)
+	c.Assert(err, check.IsNil)
+	defer conn.Close()
+	_, err = conn.ExecContext(ctx, `SELECT 1`)
+	c.Assert(err, check.IsNil)
+}
+
 func (s *IntegrationSuite) TearDownSuite(c *check.C) {
 	for _, c := range s.testClusters {
 		c.super.Stop()
diff --git a/lib/controller/router/response.go b/lib/controller/router/response.go
index f062da78f..9b945c519 100644
--- a/lib/controller/router/response.go
+++ b/lib/controller/router/response.go
@@ -108,7 +108,7 @@ func (rtr *router) sendResponse(w http.ResponseWriter, req *http.Request, resp i
 
 	for k, v := range tmp {
 		if k == "output_uuid" {
-			if tv == "" {
+			if v == "" {
 				tmp[k] = nil
 			}
 		}

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list