99 "testing"
1010 "time"
1111
12+ apistatus "github.com/nspcc-dev/neofs-sdk-go/client/status"
1213 "github.com/nspcc-dev/neofs-sdk-go/container"
1314 cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
1415 cidtest "github.com/nspcc-dev/neofs-sdk-go/container/id/test"
@@ -24,6 +25,7 @@ import (
2425 protonetmap "github.com/nspcc-dev/neofs-sdk-go/proto/netmap"
2526 protorefs "github.com/nspcc-dev/neofs-sdk-go/proto/refs"
2627 protosession "github.com/nspcc-dev/neofs-sdk-go/proto/session"
28+ protostatus "github.com/nspcc-dev/neofs-sdk-go/proto/status"
2729 "github.com/nspcc-dev/neofs-sdk-go/session"
2830 sessiontest "github.com/nspcc-dev/neofs-sdk-go/session/test"
2931 "github.com/nspcc-dev/neofs-sdk-go/stat"
@@ -1409,6 +1411,25 @@ func TestClient_ContainerDelete(t *testing.T) {
14091411 }
14101412 })
14111413 t .Run ("statuses" , func (t * testing.T ) {
1414+ t .Run ("locked" , func (t * testing.T ) {
1415+ srv := newTestDeleteContainerServer ()
1416+ c := newTestContainerClient (t , srv )
1417+
1418+ st := protostatus.Status {Code : 3074 }
1419+
1420+ srv .respondWithStatus (& st )
1421+
1422+ err := c .ContainerDelete (ctx , anyID , anyValidSigner , anyValidOpts )
1423+ require .ErrorIs (t , err , apistatus .ErrContainerLocked )
1424+ require .EqualError (t , err , "status: code = 3074 message = container is locked" )
1425+
1426+ st .Message = "some lock context"
1427+
1428+ err = c .ContainerDelete (ctx , anyID , anyValidSigner , anyValidOpts )
1429+ require .ErrorIs (t , err , apistatus .ErrContainerLocked )
1430+ require .EqualError (t , err , "status: code = 3074 message = some lock context" )
1431+ })
1432+
14121433 testStatusResponses (t , newTestDeleteContainerServer , newTestContainerClient , func (c * Client ) error {
14131434 return c .ContainerDelete (ctx , anyID , anyValidSigner , anyValidOpts )
14141435 })
0 commit comments