[ARVADOS] updated: 8fc7e0dd5d214e3881b8a56669f82d76aa70bfdb

Git user git at public.curoverse.com
Tue Oct 31 17:10:27 EDT 2017


Summary of changes:
 tools/arv-sync-groups/arv-sync-groups_test.go | 65 +++++----------------------
 1 file changed, 11 insertions(+), 54 deletions(-)

       via  8fc7e0dd5d214e3881b8a56669f82d76aa70bfdb (commit)
      from  326c51070de62ecbb498f3f182ae3653bfc9ee8d (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 8fc7e0dd5d214e3881b8a56669f82d76aa70bfdb
Author: Lucas Di Pentima <ldipentima at veritasgenetics.com>
Date:   Tue Oct 31 18:07:01 2017 -0300

    12018: Added API server start/stop calls to test suite.
    Removed manual database cleanup in favour of using the database
    reset endpoint after every test run.
    Moved tool config set up code from the suite set up call to the test
    set up, because the database get reset to fixture state after every
    test run.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima at veritasgenetics.com>

diff --git a/tools/arv-sync-groups/arv-sync-groups_test.go b/tools/arv-sync-groups/arv-sync-groups_test.go
index 81ae0be..e776648 100644
--- a/tools/arv-sync-groups/arv-sync-groups_test.go
+++ b/tools/arv-sync-groups/arv-sync-groups_test.go
@@ -27,6 +27,14 @@ type TestSuite struct {
 }
 
 func (s *TestSuite) SetUpSuite(c *C) {
+	arvadostest.StartAPI()
+}
+
+func (s *TestSuite) TearDownSuite(c *C) {
+	arvadostest.StopAPI()
+}
+
+func (s *TestSuite) SetUpTest(c *C) {
 	ac := arvados.NewClientFromEnv()
 	u, err := ac.CurrentUser()
 	c.Assert(err, IsNil)
@@ -77,61 +85,10 @@ func (s *TestSuite) SetUpSuite(c *C) {
 
 // Clean any membership link and remote group created by the test
 func (s *TestSuite) TearDownTest(c *C) {
-	gl := arvados.GroupList{}
-	params := arvados.ResourceListParams{
-		Filters: []arvados.Filter{{
-			Attr:     "group_class",
-			Operator: "=",
-			Operand:  "role",
-		}, {
-			Attr:     "owner_uuid",
-			Operator: "=",
-			Operand:  s.cfg.ParentGroupUUID,
-		}},
-	}
-	err := s.cfg.Client.RequestAndDecode(&gl, "GET", "/arvados/v1/groups", nil, params)
+	var dst interface{}
+	// Reset database to fixture state after every test run.
+	err := s.cfg.Client.RequestAndDecode(&dst, "POST", "/database/reset", nil, nil)
 	c.Assert(err, IsNil)
-	for _, group := range gl.Items {
-		ll := arvados.LinkList{}
-		// Delete user->group links
-		params = arvados.ResourceListParams{
-			Filters: []arvados.Filter{{
-				Attr:     "link_class",
-				Operator: "=",
-				Operand:  "permission",
-			}, {
-				Attr:     "head_uuid",
-				Operator: "=",
-				Operand:  group.UUID,
-			}},
-		}
-		err = s.cfg.Client.RequestAndDecode(&ll, "GET", "/arvados/v1/links", nil, params)
-		c.Assert(err, IsNil)
-		for _, link := range ll.Items {
-			err = DeleteLink(s.cfg, link.UUID)
-			c.Assert(err, IsNil)
-		}
-		// Delete group->user links
-		params = arvados.ResourceListParams{
-			Filters: []arvados.Filter{{
-				Attr:     "link_class",
-				Operator: "=",
-				Operand:  "permission",
-			}, {
-				Attr:     "tail_uuid",
-				Operator: "=",
-				Operand:  group.UUID,
-			}},
-		}
-		s.cfg.Client.RequestAndDecode(&ll, "GET", "/arvados/v1/links", nil, params)
-		for _, link := range ll.Items {
-			err = DeleteLink(s.cfg, link.UUID)
-			c.Assert(err, IsNil)
-		}
-		// Delete group
-		err = s.cfg.Client.RequestAndDecode(&arvados.Group{}, "DELETE", "/arvados/v1/groups/"+group.UUID, nil, nil)
-		c.Assert(err, IsNil)
-	}
 }
 
 var _ = Suite(&TestSuite{})

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list