2021-11-08 12:25:13 +00:00
|
|
|
package containertest
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/nspcc-dev/neofs-sdk-go/container"
|
2022-06-20 15:28:27 +00:00
|
|
|
"github.com/nspcc-dev/neofs-sdk-go/container/acl"
|
2021-11-08 12:25:13 +00:00
|
|
|
cidtest "github.com/nspcc-dev/neofs-sdk-go/container/id/test"
|
|
|
|
netmaptest "github.com/nspcc-dev/neofs-sdk-go/netmap/test"
|
2022-04-11 06:30:22 +00:00
|
|
|
usertest "github.com/nspcc-dev/neofs-sdk-go/user/test"
|
2021-11-08 12:25:13 +00:00
|
|
|
versiontest "github.com/nspcc-dev/neofs-sdk-go/version/test"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Attribute returns random container.Attribute.
|
|
|
|
func Attribute() *container.Attribute {
|
|
|
|
x := container.NewAttribute()
|
|
|
|
|
|
|
|
x.SetKey("key")
|
|
|
|
x.SetValue("value")
|
|
|
|
|
|
|
|
return x
|
|
|
|
}
|
|
|
|
|
|
|
|
// Attributes returns random container.Attributes.
|
|
|
|
func Attributes() container.Attributes {
|
2022-03-11 09:13:56 +00:00
|
|
|
return container.Attributes{*Attribute(), *Attribute()}
|
2021-11-08 12:25:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Container returns random container.Container.
|
|
|
|
func Container() *container.Container {
|
|
|
|
x := container.New()
|
2022-03-23 15:35:44 +00:00
|
|
|
ver := versiontest.Version()
|
2021-11-08 12:25:13 +00:00
|
|
|
|
2022-03-23 15:35:44 +00:00
|
|
|
x.SetVersion(&ver)
|
2021-11-08 12:25:13 +00:00
|
|
|
x.SetAttributes(Attributes())
|
2022-04-11 06:30:22 +00:00
|
|
|
x.SetOwnerID(usertest.ID())
|
2022-06-20 15:28:27 +00:00
|
|
|
x.SetBasicACL(BasicACL())
|
2022-06-07 08:25:34 +00:00
|
|
|
p := netmaptest.PlacementPolicy()
|
|
|
|
x.SetPlacementPolicy(&p)
|
2021-11-08 12:25:13 +00:00
|
|
|
|
|
|
|
return x
|
|
|
|
}
|
|
|
|
|
|
|
|
// UsedSpaceAnnouncement returns random container.UsedSpaceAnnouncement.
|
|
|
|
func UsedSpaceAnnouncement() *container.UsedSpaceAnnouncement {
|
|
|
|
x := container.NewAnnouncement()
|
|
|
|
|
2021-11-12 11:19:16 +00:00
|
|
|
x.SetContainerID(cidtest.ID())
|
2021-11-08 12:25:13 +00:00
|
|
|
x.SetEpoch(55)
|
|
|
|
x.SetUsedSpace(999)
|
|
|
|
|
|
|
|
return x
|
|
|
|
}
|
2022-06-20 15:28:27 +00:00
|
|
|
|
|
|
|
// BasicACL returns random acl.Basic.
|
|
|
|
func BasicACL() (x acl.Basic) {
|
|
|
|
x.FromBits(0xffffffff)
|
|
|
|
return
|
|
|
|
}
|