16981: Retrieves the local clusterID from exported config.
authorLucas Di Pentima <lucas@di-pentima.com.ar>
Thu, 8 Oct 2020 21:01:09 +0000 (18:01 -0300)
committerLucas Di Pentima <lucas@di-pentima.com.ar>
Thu, 8 Oct 2020 21:01:09 +0000 (18:01 -0300)
Also, fixed tests by not starting a new api server and using what run-tests
provides.

Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas@di-pentima.com.ar>

tools/sync-groups/sync-groups.go
tools/sync-groups/sync-groups_test.go

index 4d03ba89e327aa7db1bd9f08808e15d3f0487c9f..5fdd82bfae43e6cdcb925ab26eabc4d752c6dbcb 100644 (file)
@@ -275,7 +275,13 @@ func GetConfig() (config ConfigParams, err error) {
        if !u.IsActive || !u.IsAdmin {
                return config, fmt.Errorf("current user (%s) is not an active admin user", u.UUID)
        }
-       config.SysUserUUID = u.UUID[:12] + "000000000000000"
+
+       var ac struct{ ClusterID string }
+       err = config.Client.RequestAndDecode(&ac, "GET", "arvados/v1/config", nil, nil)
+       if err != nil {
+               return config, fmt.Errorf("error getting the exported config: %s", err)
+       }
+       config.SysUserUUID = ac.ClusterID + "-tpzed-000000000000000"
 
        // Set up remote groups' parent
        if err = SetParentGroup(&config); err != nil {
index 2da8c1cdde4bb2cf131e9afcd520eec7f4e5ed47..ec2f18a307d70c9767efcdef96574aa18d2cc862 100644 (file)
@@ -26,14 +26,6 @@ type TestSuite struct {
        users map[string]arvados.User
 }
 
-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()