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

Merged
fyrchik merged 1 commit from aarifullin/frostfs-node:fix/118-unit_test into master 2023-04-19 16:03:40 +00:00

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)
}