[#225] container/acl: Fix minor places

Make test value generator to be random as documented. Add `default`
keyword to switch-case to avoid linter comments.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2022-06-21 12:42:18 +03:00 committed by fyrchik
parent c4ebe8d854
commit 3b15a01327
2 changed files with 7 additions and 7 deletions

View file

@ -68,7 +68,7 @@ func (x *Basic) DisableExtension() {
// Extendable checks if Basic is NOT made FINAL using DisableExtension. // Extendable checks if Basic is NOT made FINAL using DisableExtension.
// //
// Zero Basic is NOT FINAL or extendable. // Zero Basic is extendable.
func (x Basic) Extendable() bool { func (x Basic) Extendable() bool {
return !isBitSet(x.bits, bitPosFinal) return !isBitSet(x.bits, bitPosFinal)
} }
@ -90,8 +90,9 @@ func (x Basic) Sticky() bool {
// checks if op is used by the storage nodes within replication mechanism. // checks if op is used by the storage nodes within replication mechanism.
func isReplicationOp(op Op) bool { func isReplicationOp(op Op) bool {
//nolint:exhaustive
switch op { switch op {
default:
return false
case case
OpObjectGet, OpObjectGet,
OpObjectHead, OpObjectHead,
@ -100,8 +101,6 @@ func isReplicationOp(op Op) bool {
OpObjectHash: OpObjectHash:
return true return true
} }
return false
} }
// AllowOp allows the parties with the given role to the given operation. // AllowOp allows the parties with the given role to the given operation.
@ -195,8 +194,7 @@ func (x Basic) IsOpAllowed(op Op, role Role) bool {
} }
// AllowBearerRules allows bearer to provide extended ACL rules for the given // AllowBearerRules allows bearer to provide extended ACL rules for the given
// operation. Bearer rules doesn't depend on container ACL // operation. Bearer rules doesn't depend on container ACL extensibility.
// // extensibility.
// //
// See also AllowedBearerRules. // See also AllowedBearerRules.
func (x *Basic) AllowBearerRules(op Op) { func (x *Basic) AllowBearerRules(op Op) {

View file

@ -1,6 +1,8 @@
package containertest package containertest
import ( import (
"math/rand"
"github.com/nspcc-dev/neofs-sdk-go/container" "github.com/nspcc-dev/neofs-sdk-go/container"
"github.com/nspcc-dev/neofs-sdk-go/container/acl" "github.com/nspcc-dev/neofs-sdk-go/container/acl"
cidtest "github.com/nspcc-dev/neofs-sdk-go/container/id/test" cidtest "github.com/nspcc-dev/neofs-sdk-go/container/id/test"
@ -52,6 +54,6 @@ func UsedSpaceAnnouncement() *container.UsedSpaceAnnouncement {
// BasicACL returns random acl.Basic. // BasicACL returns random acl.Basic.
func BasicACL() (x acl.Basic) { func BasicACL() (x acl.Basic) {
x.FromBits(0xffffffff) x.FromBits(rand.Uint32())
return return
} }