[#118] node: add ctx for unit tests for blobstor

Signed-off-by: Airat Arifullin a.arifullin@yadro.com
This commit is contained in:
Airat Arifullin 2023-04-19 18:09:33 +03:00
parent 3d23b08773
commit 6c90bb87f1

View file

@ -192,7 +192,7 @@ func TestConcurrentPut(t *testing.T) {
require.NoError(t, blobStor.Init())
testGet := func(t *testing.T, b *BlobStor, obj *objectSDK.Object) {
res, err := b.Get(common.GetPrm{Address: object.AddressOf(obj)})
res, err := b.Get(context.Background(), common.GetPrm{Address: object.AddressOf(obj)})
require.NoError(t, err)
require.Equal(t, obj, res.Object)
}
@ -200,14 +200,14 @@ func TestConcurrentPut(t *testing.T) {
testPut := func(t *testing.T, b *BlobStor, obj *objectSDK.Object) {
var prm common.PutPrm
prm.Object = obj
_, err := b.Put(prm)
_, err := b.Put(context.Background(), prm)
require.NoError(t, err)
}
testPutFileExistsError := func(t *testing.T, b *BlobStor, obj *objectSDK.Object) {
var prm common.PutPrm
prm.Object = obj
if _, err := b.Put(prm); err != nil {
if _, err := b.Put(context.Background(), prm); err != nil {
require.ErrorContains(t, err, "file exists")
}
}
@ -274,14 +274,14 @@ func TestConcurrentDelete(t *testing.T) {
testPut := func(t *testing.T, b *BlobStor, obj *objectSDK.Object) {
var prm common.PutPrm
prm.Object = obj
_, err := b.Put(prm)
_, err := b.Put(context.Background(), prm)
require.NoError(t, err)
}
testDelete := func(t *testing.T, b *BlobStor, obj *objectSDK.Object) {
var prm common.DeletePrm
prm.Address = object.AddressOf(obj)
if _, err := b.Delete(prm); err != nil {
if _, err := b.Delete(context.Background(), prm); err != nil {
require.ErrorContains(t, err, "object not found")
}
}
@ -289,7 +289,7 @@ func TestConcurrentDelete(t *testing.T) {
testDeletedExists := func(t *testing.T, b *BlobStor, obj *objectSDK.Object) {
var prm common.ExistsPrm
prm.Address = object.AddressOf(obj)
res, err := b.Exists(prm)
res, err := b.Exists(context.Background(), prm)
require.NoError(t, err)
require.False(t, res.Exists)
}