test: fix enumerate bug in in-memory storage when double-uploaded

Change-Id: I7e6abb1c9dfc61f39fa9d315857bf7aeb13b6b59
This commit is contained in:
Brad Fitzpatrick 2014-01-20 13:07:20 -08:00
parent cf22032792
commit 31125295a4
1 changed files with 5 additions and 2 deletions

View File

@ -56,9 +56,12 @@ func (tf *Fetcher) AddBlob(b *Blob) {
tf.m = make(map[string]*Blob)
}
key := b.BlobRef().String()
_, had := tf.m[key]
tf.m[key] = b
tf.sorted = append(tf.sorted, key)
sort.Strings(tf.sorted)
if !had {
tf.sorted = append(tf.sorted, key)
sort.Strings(tf.sorted)
}
}
func (tf *Fetcher) FetchStreaming(ref blob.Ref) (file io.ReadCloser, size int64, err error) {