[ARVADOS] updated: 2.1.0-2011-g441a934dd

Git user git at public.arvados.org
Mon Mar 7 19:59:49 UTC 2022


Summary of changes:
 lib/controller/localdb/collection.go      |  2 +-
 lib/controller/localdb/collection_test.go | 18 +++++++++++++++++-
 2 files changed, 18 insertions(+), 2 deletions(-)

       via  441a934dd0e98d622cd1ea15054c4f5b4198f2be (commit)
      from  831fac7cc24323bd48cdfd645d31153876516e55 (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 441a934dd0e98d622cd1ea15054c4f5b4198f2be
Author: Tom Clegg <tom at curii.com>
Date:   Mon Mar 7 14:59:32 2022 -0500

    18600: Add more invalid splice request tests.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>

diff --git a/lib/controller/localdb/collection.go b/lib/controller/localdb/collection.go
index 965b009f4..2283b2fcb 100644
--- a/lib/controller/localdb/collection.go
+++ b/lib/controller/localdb/collection.go
@@ -238,7 +238,7 @@ func (conn *Conn) applySplices(ctx context.Context, fromUUID string, attrs map[s
 		srcspec := strings.SplitN(src, "/", 2)
 		srcid, srcpath := srcspec[0], "/"
 		if !arvadosclient.PDHMatch(srcid) {
-			return httpserver.Errorf(http.StatusBadRequest, "invalid source %q for splices[%q]: must be \"\" or \"PDH[/path]\"", src, dst)
+			return httpserver.Errorf(http.StatusBadRequest, "invalid source %q for splices[%q]: must be \"\" or \"PDH\" or \"PDH/path\"", src, dst)
 		}
 		if len(srcspec) == 2 && srcspec[1] != "" {
 			srcpath = srcspec[1]
diff --git a/lib/controller/localdb/collection_test.go b/lib/controller/localdb/collection_test.go
index 27cdf3899..e71ae35c2 100644
--- a/lib/controller/localdb/collection_test.go
+++ b/lib/controller/localdb/collection_test.go
@@ -219,6 +219,7 @@ func (s *CollectionSuite) TestCollectionUpdateFiles(c *check.C) {
 	c.Check(dstcopy.PortableDataHash, check.Equals, dst.PortableDataHash)
 	s.expectFiles(c, dstcopy, "b/corge.txt")
 
+	// Check invalid targets, sources, and combinations
 	for _, splices := range []map[string]string{
 		{
 			"/foo/nope": dst.PortableDataHash + "/b",
@@ -256,9 +257,14 @@ func (s *CollectionSuite) TestCollectionUpdateFiles(c *check.C) {
 		c.Logf("splices %#v\n... got err: %s", splices, err)
 		c.Check(err, check.NotNil)
 	}
+
+	// Check "splices" value that isn't even the right type
 	for _, splices := range []interface{}{
 		map[string]int{"foo": 1},
 		map[int]string{1: "foo"},
+		12345,
+		"foo",
+		[]string{"foo"},
 	} {
 		_, err = s.localdb.CollectionUpdate(ctx, arvados.UpdateOptions{
 			UUID: dst.UUID,
@@ -266,8 +272,18 @@ func (s *CollectionSuite) TestCollectionUpdateFiles(c *check.C) {
 				"splices": splices,
 			}})
 		c.Logf("splices %#v\n... got err: %s", splices, err)
-		c.Check(err, check.NotNil)
+		c.Check(err, check.ErrorMatches, "invalid type .* for splices parameter")
 	}
+
+	// Check conflicting splices and manifest_text
+	_, err = s.localdb.CollectionUpdate(ctx, arvados.UpdateOptions{
+		UUID: dst.UUID,
+		Attrs: map[string]interface{}{
+			"splices":       map[string]string{"/": ""},
+			"manifest_text": ". d41d8cd98f00b204e9800998ecf8427e+0 0:0:z\n",
+		}})
+	c.Logf("splices+manifest_text\n... got err: %s", err)
+	c.Check(err, check.ErrorMatches, "ambiguous request: both.*splices.*manifest_text.*")
 }
 
 // expectFiles checks coll's directory structure against the given

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list