-
Notifications
You must be signed in to change notification settings - Fork 291
/
mocks.go
38 lines (34 loc) · 1.13 KB
/
mocks.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//
// (C) Copyright 2022 Intel Corporation.
//
// SPDX-License-Identifier: BSD-2-Clause-Patent
//
package checker
import (
"math/rand"
"time"
chkpb "github.com/daos-stack/daos/src/control/common/proto/chk"
"github.com/daos-stack/daos/src/control/common/test"
)
func MockFinding(idx ...int) *Finding {
if len(idx) == 0 {
idx = []int{rand.Int()}
}
return &Finding{
CheckReport: chkpb.CheckReport{
Seq: uint64(idx[0]),
Class: chkpb.CheckInconsistClass(rand.Int31n(int32(len(chkpb.CheckInconsistClass_name)))),
Action: chkpb.CheckInconsistAction(rand.Int31n(int32(len(chkpb.CheckInconsistAction_name)))),
Rank: uint32(idx[0]),
Target: uint32(idx[0]),
PoolUuid: test.MockUUID(int32(idx[0])),
ContUuid: test.MockUUID(int32(idx[0])),
Timestamp: time.Now().String(),
ActChoices: []chkpb.CheckInconsistAction{
chkpb.CheckInconsistAction(rand.Int31n(int32(len(chkpb.CheckInconsistAction_name)))),
chkpb.CheckInconsistAction(rand.Int31n(int32(len(chkpb.CheckInconsistAction_name)))),
chkpb.CheckInconsistAction(rand.Int31n(int32(len(chkpb.CheckInconsistAction_name)))),
},
},
}
}