forked from TrueCloudLab/frostfs-api-go
[#106] test: Generate correct data for tests
Some tests are using invalid data that do not meet the requirements of the FrostFS protocol, e.g. - Container/Object IDs aren't 32 bytes long - Signature key and sign have invalid length - Split IDs aren't valid UUIDv4 and etc. Signed-off-by: Aleksey Savchuk <a.savchuk@yadro.com>
This commit is contained in:
parent
5e1c6a908f
commit
9c5e32a183
5 changed files with 66 additions and 17 deletions
|
@ -1,6 +1,7 @@
|
|||
package sessiontest
|
||||
|
||||
import (
|
||||
crand "crypto/rand"
|
||||
"math/rand"
|
||||
"time"
|
||||
|
||||
|
@ -38,7 +39,10 @@ func GenerateCreateResponseBody(empty bool) *session.CreateResponseBody {
|
|||
m := new(session.CreateResponseBody)
|
||||
|
||||
if !empty {
|
||||
m.SetID([]byte{1, 2, 3})
|
||||
id := make([]byte, 16)
|
||||
_, _ = crand.Read(id)
|
||||
|
||||
m.SetID(id)
|
||||
m.SetSessionKey([]byte{4, 5, 6})
|
||||
}
|
||||
|
||||
|
@ -164,7 +168,10 @@ func GenerateSessionTokenBody(empty bool) *session.TokenBody {
|
|||
m := new(session.TokenBody)
|
||||
|
||||
if !empty {
|
||||
m.SetID([]byte{1})
|
||||
id := make([]byte, 16)
|
||||
_, _ = crand.Read(id)
|
||||
|
||||
m.SetID(id)
|
||||
m.SetSessionKey([]byte{2})
|
||||
m.SetOwnerID(refstest.GenerateOwnerID(false))
|
||||
m.SetLifetime(GenerateTokenLifetime(false))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue