[ARVADOS] updated: 3de17b282e8fc732862bd028c6d63ecfe70075af

Git user git at public.curoverse.com
Tue Oct 24 22:54:53 EDT 2017


Summary of changes:
 build/run-tests.sh                            |  2 +
 tools/arv-sync-groups/arv-sync-groups_test.go | 59 +++++++++++++++++++++++++++
 2 files changed, 61 insertions(+)
 create mode 100644 tools/arv-sync-groups/arv-sync-groups_test.go

       via  3de17b282e8fc732862bd028c6d63ecfe70075af (commit)
      from  e2c27eaae38a904a4b05d800affdc7860ee24e79 (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 3de17b282e8fc732862bd028c6d63ecfe70075af
Author: Lucas Di Pentima <ldipentima at veritasgenetics.com>
Date:   Tue Oct 24 23:54:30 2017 -0300

    12018: Added basic tests
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima at veritasgenetics.com>

diff --git a/build/run-tests.sh b/build/run-tests.sh
index d8d4e3b..b63a1b9 100755
--- a/build/run-tests.sh
+++ b/build/run-tests.sh
@@ -103,6 +103,7 @@ sdk/go/streamer
 sdk/go/stats
 sdk/go/crunchrunner
 sdk/cwl
+tools/arv-sync-groups
 tools/crunchstat-summary
 tools/keep-exercise
 tools/keep-rsync
@@ -812,6 +813,7 @@ gostuff=(
     tools/keep-block-check
     tools/keep-exercise
     tools/keep-rsync
+    tools/arv-sync-groups
 )
 for g in "${gostuff[@]}"
 do
diff --git a/tools/arv-sync-groups/arv-sync-groups_test.go b/tools/arv-sync-groups/arv-sync-groups_test.go
new file mode 100644
index 0000000..8356f69
--- /dev/null
+++ b/tools/arv-sync-groups/arv-sync-groups_test.go
@@ -0,0 +1,59 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+package main
+
+import (
+	"os"
+	"testing"
+
+	"git.curoverse.com/arvados.git/sdk/go/arvados"
+	. "gopkg.in/check.v1"
+)
+
+// Gocheck boilerplate
+func Test(t *testing.T) {
+	TestingT(t)
+}
+
+type TestSuite struct{}
+
+var _ = Suite(&TestSuite{})
+
+func (s *TestSuite) TestParseFlagsWithPath(c *C) {
+	cfg := ConfigParams{}
+	os.Args = []string{"cmd", "-path", "/tmp/somefile.csv", "-verbose"}
+	err := ParseFlags(&cfg)
+	c.Assert(err, IsNil)
+	c.Assert(cfg.Path, Equals, "/tmp/somefile.csv")
+	c.Assert(cfg.Verbose, Equals, true)
+}
+
+func (s *TestSuite) TestParseFlagsWithoutPath(c *C) {
+	os.Args = []string{"cmd", "-verbose"}
+	err := ParseFlags(&ConfigParams{})
+	c.Assert(err, NotNil)
+}
+
+func (s *TestSuite) TestGetUserID(c *C) {
+	u := arvados.User{
+		Email:    "testuser at example.com",
+		Username: "Testuser",
+	}
+	email, err := GetUserID(u, "email")
+	c.Assert(err, IsNil)
+	c.Assert(email, Equals, "testuser at example.com")
+	_, err = GetUserID(u, "bogus")
+	c.Assert(err, NotNil)
+}
+
+func (s *TestSuite) TestGetConfig(c *C) {
+	os.Args = []string{"cmd", "-path", "/tmp/somefile.csv"}
+	cfg, err := GetConfig()
+	c.Assert(err, IsNil)
+	c.Assert(cfg.SysUserUUID, NotNil)
+	c.Assert(cfg.Client, NotNil)
+	c.Assert(cfg.ParentGroupUUID, NotNil)
+	c.Assert(cfg.ParentGroupName, Equals, "Externally synchronized groups")
+}

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list