[ARVADOS] updated: 2.1.0-543-g63f2e3b96

Git user git at public.arvados.org
Fri Apr 9 17:19:07 UTC 2021


Summary of changes:
 lib/controller/federation/federation_test.go | 28 +++++++++++++++++++++++++---
 lib/controller/federation/login_test.go      |  2 +-
 2 files changed, 26 insertions(+), 4 deletions(-)

       via  63f2e3b96f6d1a7cfa626f729b6907655e6dad67 (commit)
      from  c7c08265ddec9f990c9dce9befa21d555983e43e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 63f2e3b96f6d1a7cfa626f729b6907655e6dad67
Author: Tom Clegg <tom at curii.com>
Date:   Fri Apr 9 13:18:55 2021 -0400

    16159: Provide a localdb transaction for federation tests.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>

diff --git a/lib/controller/federation/federation_test.go b/lib/controller/federation/federation_test.go
index 5079b402b..50f7eea42 100644
--- a/lib/controller/federation/federation_test.go
+++ b/lib/controller/federation/federation_test.go
@@ -10,13 +10,16 @@ import (
 	"os"
 	"testing"
 
+	"git.arvados.org/arvados.git/lib/config"
 	"git.arvados.org/arvados.git/lib/controller/router"
 	"git.arvados.org/arvados.git/lib/controller/rpc"
+	"git.arvados.org/arvados.git/lib/ctrlctx"
 	"git.arvados.org/arvados.git/sdk/go/arvados"
 	"git.arvados.org/arvados.git/sdk/go/arvadostest"
 	"git.arvados.org/arvados.git/sdk/go/auth"
 	"git.arvados.org/arvados.git/sdk/go/ctxlog"
 	"git.arvados.org/arvados.git/sdk/go/httpserver"
+	"github.com/jmoiron/sqlx"
 	check "gopkg.in/check.v1"
 )
 
@@ -28,9 +31,18 @@ func Test(t *testing.T) {
 // FederationSuite does some generic setup/teardown. Don't add Test*
 // methods to FederationSuite itself.
 type FederationSuite struct {
-	cluster *arvados.Cluster
-	ctx     context.Context
-	fed     *Conn
+	integrationTestCluster *arvados.Cluster
+	cluster                *arvados.Cluster
+	ctx                    context.Context
+	tx                     *sqlx.Tx
+	fed                    *Conn
+}
+
+func (s *FederationSuite) SetUpSuite(c *check.C) {
+	cfg, err := config.NewLoader(nil, ctxlog.TestLogger(c)).Load()
+	c.Assert(err, check.IsNil)
+	s.integrationTestCluster, err = cfg.GetCluster("")
+	c.Assert(err, check.IsNil)
 }
 
 func (s *FederationSuite) SetUpTest(c *check.C) {
@@ -42,19 +54,29 @@ func (s *FederationSuite) SetUpTest(c *check.C) {
 				Host: os.Getenv("ARVADOS_API_HOST"),
 			},
 		},
+		PostgreSQL: s.integrationTestCluster.PostgreSQL,
 	}
 	arvadostest.SetServiceURL(&s.cluster.Services.RailsAPI, "https://"+os.Getenv("ARVADOS_TEST_API_HOST"))
 	s.cluster.TLS.Insecure = true
 	s.cluster.API.MaxItemsPerResponse = 3
 
+	tx, err := arvadostest.DB(c, s.cluster).Beginx()
+	c.Assert(err, check.IsNil)
+	s.tx = tx
+
 	ctx := context.Background()
 	ctx = ctxlog.Context(ctx, ctxlog.TestLogger(c))
 	ctx = auth.NewContext(ctx, &auth.Credentials{Tokens: []string{arvadostest.ActiveTokenV2}})
+	ctx = ctrlctx.NewWithTransaction(ctx, s.tx)
 	s.ctx = ctx
 
 	s.fed = New(s.cluster)
 }
 
+func (s *FederationSuite) TearDownTest(c *check.C) {
+	s.tx.Rollback()
+}
+
 func (s *FederationSuite) addDirectRemote(c *check.C, id string, backend backend) {
 	s.cluster.RemoteClusters[id] = arvados.RemoteCluster{
 		Host: "in-process.local",
diff --git a/lib/controller/federation/login_test.go b/lib/controller/federation/login_test.go
index 007f5df8b..5353ebf0f 100644
--- a/lib/controller/federation/login_test.go
+++ b/lib/controller/federation/login_test.go
@@ -62,7 +62,7 @@ func (s *LoginSuite) TestLogout(c *check.C) {
 		{token: "v2/zhome-aaaaa-aaaaaaaaaaaaaaa/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", returnTo: returnTo, target: "http://" + s.cluster.RemoteClusters["zhome"].Host + "/logout?" + url.Values{"return_to": {returnTo}}.Encode()},
 	} {
 		c.Logf("trial %#v", trial)
-		ctx := context.Background()
+		ctx := s.ctx
 		if trial.token != "" {
 			ctx = auth.NewContext(ctx, &auth.Credentials{Tokens: []string{trial.token}})
 		}

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list