[ARVADOS] created: 1.3.0-1294-gcfb6b08b9

Git user git at public.curoverse.com
Thu Jul 11 19:51:18 UTC 2019


        at  cfb6b08b94d423a768862481b629cfb21fcc70a2 (commit)


commit cfb6b08b94d423a768862481b629cfb21fcc70a2
Author: Tom Clegg <tclegg at veritasgenetics.com>
Date:   Thu Jul 11 15:51:09 2019 -0400

    15003: Ensure all map[string]* have sample keys.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg at veritasgenetics.com>

diff --git a/lib/config/load_test.go b/lib/config/load_test.go
index 6b014476b..6e8b6208d 100644
--- a/lib/config/load_test.go
+++ b/lib/config/load_test.go
@@ -9,6 +9,7 @@ import (
 	"io"
 	"os"
 	"os/exec"
+	"reflect"
 	"strings"
 	"testing"
 
@@ -97,6 +98,42 @@ Clusters:
 	c.Check(logs, check.HasLen, 2)
 }
 
+func (s *LoadSuite) checkSAMPLEKeys(c *check.C, path string, x interface{}) {
+	v := reflect.Indirect(reflect.ValueOf(x))
+	switch v.Kind() {
+	case reflect.Map:
+		var stringKeys, sampleKey bool
+		iter := v.MapRange()
+		for iter.Next() {
+			k := iter.Key()
+			if k.Kind() == reflect.String {
+				stringKeys = true
+				if k.String() == "SAMPLE" || k.String() == "xxxxx" {
+					sampleKey = true
+					s.checkSAMPLEKeys(c, path+"."+k.String(), iter.Value().Interface())
+				}
+			}
+		}
+		if stringKeys && !sampleKey {
+			c.Errorf("%s is a map with string keys (type %T) but config.default.yml has no SAMPLE key", path, x)
+		}
+		return
+	case reflect.Struct:
+		for i := 0; i < v.NumField(); i++ {
+			val := v.Field(i)
+			if val.CanInterface() {
+				s.checkSAMPLEKeys(c, path+"."+v.Type().Field(i).Name, val.Interface())
+			}
+		}
+	}
+}
+
+func (s *LoadSuite) TestDefaultConfigHasAllSAMPLEKeys(c *check.C) {
+	cfg, err := Load(bytes.NewBuffer(DefaultYAML), ctxlog.TestLogger(c))
+	c.Assert(err, check.IsNil)
+	s.checkSAMPLEKeys(c, "", cfg)
+}
+
 func (s *LoadSuite) TestNoUnrecognizedKeysInDefaultConfig(c *check.C) {
 	var logbuf bytes.Buffer
 	logger := logrus.New()
diff --git a/sdk/go/arvados/config.go b/sdk/go/arvados/config.go
index 9c667610b..07be5d51b 100644
--- a/sdk/go/arvados/config.go
+++ b/sdk/go/arvados/config.go
@@ -76,13 +76,17 @@ type Cluster struct {
 		UnloggedAttributes []string
 	}
 	Collections struct {
-		BlobSigning           bool
-		BlobSigningKey        string
-		BlobSigningTTL        Duration
-		CollectionVersioning  bool
-		DefaultTrashLifetime  Duration
-		DefaultReplication    int
-		ManagedProperties     map[string]interface{}
+		BlobSigning          bool
+		BlobSigningKey       string
+		BlobSigningTTL       Duration
+		CollectionVersioning bool
+		DefaultTrashLifetime Duration
+		DefaultReplication   int
+		ManagedProperties    map[string]struct {
+			Value     interface{}
+			Function  string
+			Protected bool
+		}
 		PreserveVersionIfIdle Duration
 		TrashSweepInterval    Duration
 		TrustAllContent       bool

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list