func estimateDockerImageSize(collectionPDH string) int64 {
m := pdhRegexp.FindStringSubmatch(collectionPDH)
if m == nil {
+ log.Printf("estimateDockerImageSize: '%v' did not match pdhRegexp, returning 0", collectionPDH)
return 0
}
n, err := strconv.ParseInt(m[1], 10, 64)
if err != nil || n < 122 {
+ log.Printf("estimateDockerImageSize: short manifest %v or error (%v), returning 0", n, err)
return 0
}
// To avoid having to fetch the collection, take advantage of
// Estimated size is 384 MiB (402653184 bytes)
// Want to reserve 2x the estimated size, so 805306368 bytes
c.Check(n, check.Equals, int64(805306368))
+
+ n = EstimateScratchSpace(&arvados.Container{
+ ContainerImage: "d5025c0f29f6eef304a7358afa82a822+-342",
+ })
+ // Parse error will return 0
+ c.Check(n, check.Equals, int64(0))
+
+ n = EstimateScratchSpace(&arvados.Container{
+ ContainerImage: "d5025c0f29f6eef304a7358afa82a822+34",
+ })
+ // Short manifest will return 0
+ c.Check(n, check.Equals, int64(0))
}