frostfs-api-go/object/status_test.go
Airat Arifullin bc16a32c24
All checks were successful
Tests and linters / Tests (1.19) (pull_request) Successful in 45s
Tests and linters / Lint (pull_request) Successful in 56s
Tests and linters / Tests (1.20) (pull_request) Successful in 2m3s
Tests and linters / Tests with -race (pull_request) Successful in 2m13s
[#40] types: Generate StableMarshaler/StableSize methods for protobufs
* Add plugin option for protogen in Makefile
* Fix the generator for the plugin in util/protogen
* Erase convertable types, move helpful methods to gRPC protobufs
* Erase helpers for convertations
* Generate StableMarshlal/StableSize for protobufs by the protoc plugin

Signed-off-by: Airat Arifullin a.arifullin@yadro.com
2023-07-10 12:08:48 +03:00

35 lines
979 B
Go

package object_test
import (
"testing"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object"
statusgrpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/status/grpc"
statustest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/status/test"
"github.com/stretchr/testify/require"
)
func TestStatusCodes(t *testing.T) {
statustest.TestCodes(t, object.LocalizeFailStatus, object.GlobalizeFail,
object.StatusAccessDenied, 2048,
object.StatusNotFound, 2049,
object.StatusLocked, 2050,
object.StatusLockNonRegularObject, 2051,
object.StatusAlreadyRemoved, 2052,
object.StatusOutOfRange, 2053,
)
}
func TestAccessDeniedDesc(t *testing.T) {
st := new(statusgrpc.Status)
require.Empty(t, object.ReadAccessDeniedDesc(st))
const desc = "some description"
object.WriteAccessDeniedDesc(st, desc)
require.Equal(t, desc, object.ReadAccessDeniedDesc(st))
object.WriteAccessDeniedDesc(st, desc+"1")
require.Equal(t, desc+"1", object.ReadAccessDeniedDesc(st))
}