19886: Bugfix UUID generation in crunch-run tests
authorBrett Smith <brett.smith@curii.com>
Thu, 12 Jan 2023 21:48:12 +0000 (16:48 -0500)
committerBrett Smith <brett.smith@curii.com>
Fri, 13 Jan 2023 14:36:43 +0000 (09:36 -0500)
The previous code was generating UUIDs with a 30-character last part.

Arvados-DCO-1.1-Signed-off-by: Brett Smith <brett.smith@curii.com>

lib/crunchrun/crunchrun_test.go

index 8da933a7300a2fc08f44714d3aa5434617fa13e3..735385a6f08fde666355272d0255b44231dd92b9 100644 (file)
@@ -188,9 +188,10 @@ func (client *ArvTestClient) Create(resourceType string,
 
        if resourceType == "collections" && output != nil {
                mt := parameters["collection"].(arvadosclient.Dict)["manifest_text"].(string)
+               md5sum := md5.Sum([]byte(mt))
                outmap := output.(*arvados.Collection)
-               outmap.PortableDataHash = fmt.Sprintf("%x+%d", md5.Sum([]byte(mt)), len(mt))
-               outmap.UUID = fmt.Sprintf("zzzzz-4zz18-%15.15x", md5.Sum([]byte(mt)))
+               outmap.PortableDataHash = fmt.Sprintf("%x+%d", md5sum, len(mt))
+               outmap.UUID = fmt.Sprintf("zzzzz-4zz18-%015x", md5sum[:7])
        }
 
        return nil