2021-11-08 12:25:13 +00:00
|
|
|
package containertest
|
|
|
|
|
|
|
|
import (
|
2022-06-21 09:42:18 +00:00
|
|
|
"math/rand"
|
|
|
|
|
2022-12-13 14:36:35 +00:00
|
|
|
"github.com/TrueCloudLab/frostfs-sdk-go/container"
|
|
|
|
"github.com/TrueCloudLab/frostfs-sdk-go/container/acl"
|
|
|
|
cidtest "github.com/TrueCloudLab/frostfs-sdk-go/container/id/test"
|
|
|
|
netmaptest "github.com/TrueCloudLab/frostfs-sdk-go/netmap/test"
|
|
|
|
usertest "github.com/TrueCloudLab/frostfs-sdk-go/user/test"
|
2021-11-08 12:25:13 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// Container returns random container.Container.
|
2022-06-25 09:54:42 +00:00
|
|
|
func Container() (x container.Container) {
|
|
|
|
owner := usertest.ID()
|
2021-11-08 12:25:13 +00:00
|
|
|
|
2022-06-25 09:54:42 +00:00
|
|
|
x.Init()
|
|
|
|
x.SetAttribute("some attribute", "value")
|
|
|
|
x.SetOwner(*owner)
|
2022-06-20 15:28:27 +00:00
|
|
|
x.SetBasicACL(BasicACL())
|
2022-06-25 09:54:42 +00:00
|
|
|
x.SetPlacementPolicy(netmaptest.PlacementPolicy())
|
2021-11-08 12:25:13 +00:00
|
|
|
|
|
|
|
return x
|
|
|
|
}
|
|
|
|
|
2022-06-25 09:54:42 +00:00
|
|
|
// SizeEstimation returns random container.SizeEstimation.
|
|
|
|
func SizeEstimation() (x container.SizeEstimation) {
|
|
|
|
x.SetContainer(cidtest.ID())
|
|
|
|
x.SetEpoch(rand.Uint64())
|
|
|
|
x.SetValue(rand.Uint64())
|
2021-11-08 12:25:13 +00:00
|
|
|
|
|
|
|
return x
|
|
|
|
}
|
2022-06-20 15:28:27 +00:00
|
|
|
|
|
|
|
// BasicACL returns random acl.Basic.
|
|
|
|
func BasicACL() (x acl.Basic) {
|
2022-06-21 09:42:18 +00:00
|
|
|
x.FromBits(rand.Uint32())
|
2022-06-20 15:28:27 +00:00
|
|
|
return
|
|
|
|
}
|