forked from gregorynoma/tsbs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
common.go
35 lines (29 loc) · 944 Bytes
/
common.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
package common
import "math/rand"
// RandomStringSliceChoice returns a random string from the provided slice of string slices.
func RandomStringSliceChoice(s []string) string {
return s[rand.Intn(len(s))]
}
// RandomByteStringSliceChoice returns a random byte string slice from the provided slice of byte string slices.
func RandomByteStringSliceChoice(s [][]byte) []byte {
return s[rand.Intn(len(s))]
}
// RandomInt64SliceChoice returns a random int64 from an int64 slice.
func RandomInt64SliceChoice(s []int64) int64 {
return s[rand.Intn(len(s))]
}
const (
// Use case choices (make sure to update TestGetConfig if adding a new one)
UseCaseCPUOnly = "cpu-only"
UseCaseCPUSingle = "cpu-single"
UseCaseDevops = "devops"
UseCaseIoT = "iot"
UseCaseDevopsGeneric = "devops-generic"
)
var UseCaseChoices = []string{
UseCaseCPUOnly,
UseCaseCPUSingle,
UseCaseDevops,
UseCaseIoT,
UseCaseDevopsGeneric,
}