store: implement s3 blob store (#2005)

This commit is contained in:
ben-toogood 2020-09-15 17:09:40 +01:00 committed by Vasiliy Tolstov
parent 01d9bb6a59
commit c1d09f7c41
2 changed files with 3 additions and 7 deletions

View File

@ -126,11 +126,7 @@ func (b *blobStore) Delete(key string, opts ...store.BlobOption) error {
// check for the namespaces bucket // check for the namespaces bucket
bucket := tx.Bucket([]byte(options.Namespace)) bucket := tx.Bucket([]byte(options.Namespace))
if bucket == nil { if bucket == nil {
return store.ErrNotFound return nil
}
if bucket.Get([]byte(key)) == nil {
return store.ErrNotFound
} }
return bucket.Delete([]byte(key)) return bucket.Delete([]byte(key))

View File

@ -60,12 +60,12 @@ func TestBlobStore(t *testing.T) {
t.Run("DeleteIncorrectNamespace", func(t *testing.T) { t.Run("DeleteIncorrectNamespace", func(t *testing.T) {
err := blob.Delete("hello", store.BlobNamespace("bar")) err := blob.Delete("hello", store.BlobNamespace("bar"))
assert.Equal(t, store.ErrNotFound, err, "Error should be not found") assert.Nil(t, err, "Error should be nil")
}) })
t.Run("DeleteCorrectNamespaceIncorrectKey", func(t *testing.T) { t.Run("DeleteCorrectNamespaceIncorrectKey", func(t *testing.T) {
err := blob.Delete("world", store.BlobNamespace("micro")) err := blob.Delete("world", store.BlobNamespace("micro"))
assert.Equal(t, store.ErrNotFound, err, "Error should be not found") assert.Nil(t, err, "Error should be nil")
}) })
t.Run("DeleteCorrectNamespace", func(t *testing.T) { t.Run("DeleteCorrectNamespace", func(t *testing.T) {