From 3b15a01327b4df92d2cfb2a09188414b639bde31 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 21 Jun 2022 12:42:18 +0300 Subject: [PATCH] [#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 --- container/acl/acl_basic.go | 10 ++++------ container/test/generate.go | 4 +++- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/container/acl/acl_basic.go b/container/acl/acl_basic.go index f45ff012..5a27db19 100644 --- a/container/acl/acl_basic.go +++ b/container/acl/acl_basic.go @@ -68,7 +68,7 @@ func (x *Basic) 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 { 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. func isReplicationOp(op Op) bool { - //nolint:exhaustive switch op { + default: + return false case OpObjectGet, OpObjectHead, @@ -100,8 +101,6 @@ func isReplicationOp(op Op) bool { OpObjectHash: return true } - - return false } // 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 -// operation. Bearer rules doesn't depend on container ACL -// // extensibility. +// operation. Bearer rules doesn't depend on container ACL extensibility. // // See also AllowedBearerRules. func (x *Basic) AllowBearerRules(op Op) { diff --git a/container/test/generate.go b/container/test/generate.go index 036a65f8..8bd7a58a 100644 --- a/container/test/generate.go +++ b/container/test/generate.go @@ -1,6 +1,8 @@ package containertest import ( + "math/rand" + "github.com/nspcc-dev/neofs-sdk-go/container" "github.com/nspcc-dev/neofs-sdk-go/container/acl" cidtest "github.com/nspcc-dev/neofs-sdk-go/container/id/test" @@ -52,6 +54,6 @@ func UsedSpaceAnnouncement() *container.UsedSpaceAnnouncement { // BasicACL returns random acl.Basic. func BasicACL() (x acl.Basic) { - x.FromBits(0xffffffff) + x.FromBits(rand.Uint32()) return }