From 31125295a48ded450c74238a5afb25a4e4fadf98 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Mon, 20 Jan 2014 13:07:20 -0800 Subject: [PATCH] test: fix enumerate bug in in-memory storage when double-uploaded Change-Id: I7e6abb1c9dfc61f39fa9d315857bf7aeb13b6b59 --- pkg/test/fetcher.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/test/fetcher.go b/pkg/test/fetcher.go index 213582fc4..9cdd02c09 100644 --- a/pkg/test/fetcher.go +++ b/pkg/test/fetcher.go @@ -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) {