forked from TrueCloudLab/frostfs-sdk-go
[#59] audit/test: reuse version generator
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
db784a5758
commit
74a5254819
2 changed files with 19 additions and 2 deletions
|
@ -5,14 +5,14 @@ import (
|
||||||
cidtest "github.com/nspcc-dev/neofs-sdk-go/container/id/test"
|
cidtest "github.com/nspcc-dev/neofs-sdk-go/container/id/test"
|
||||||
"github.com/nspcc-dev/neofs-sdk-go/object"
|
"github.com/nspcc-dev/neofs-sdk-go/object"
|
||||||
objecttest "github.com/nspcc-dev/neofs-sdk-go/object/test"
|
objecttest "github.com/nspcc-dev/neofs-sdk-go/object/test"
|
||||||
"github.com/nspcc-dev/neofs-sdk-go/version"
|
versiontest "github.com/nspcc-dev/neofs-sdk-go/version/test"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Generate returns random audit.Result.
|
// Generate returns random audit.Result.
|
||||||
func Generate() *audit.Result {
|
func Generate() *audit.Result {
|
||||||
x := audit.NewResult()
|
x := audit.NewResult()
|
||||||
|
|
||||||
x.SetVersion(version.Current())
|
x.SetVersion(versiontest.Version())
|
||||||
x.SetContainerID(cidtest.GenerateID())
|
x.SetContainerID(cidtest.GenerateID())
|
||||||
x.SetPublicKey([]byte("key"))
|
x.SetPublicKey([]byte("key"))
|
||||||
x.SetComplete(true)
|
x.SetComplete(true)
|
||||||
|
|
17
version/test/generate.go
Normal file
17
version/test/generate.go
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
package test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"math/rand"
|
||||||
|
|
||||||
|
"github.com/nspcc-dev/neofs-sdk-go/version"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Version returns random version.Version.
|
||||||
|
func Version() *version.Version {
|
||||||
|
x := version.New()
|
||||||
|
|
||||||
|
x.SetMajor(rand.Uint32())
|
||||||
|
x.SetMinor(rand.Uint32())
|
||||||
|
|
||||||
|
return x
|
||||||
|
}
|
Loading…
Reference in a new issue