2022-02-21 17:57:27 +00:00
|
|
|
package object_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2023-03-07 10:38:56 +00:00
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object"
|
|
|
|
objecttest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object/test"
|
2022-02-21 17:57:27 +00:00
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestLockRW(t *testing.T) {
|
|
|
|
var l object.Lock
|
|
|
|
var obj object.Object
|
|
|
|
|
|
|
|
require.Error(t, object.ReadLock(&l, obj))
|
|
|
|
|
|
|
|
l = *objecttest.GenerateLock(false)
|
|
|
|
|
|
|
|
object.WriteLock(&obj, l)
|
|
|
|
|
|
|
|
var l2 object.Lock
|
|
|
|
|
|
|
|
require.NoError(t, object.ReadLock(&l2, obj))
|
|
|
|
|
|
|
|
require.Equal(t, l, l2)
|
|
|
|
}
|