Skip to content

Commit de83edf

Browse files
committed
Fix statshouse-client-test to use specified number of tags
1 parent fcd437c commit de83edf

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

cmd/statshouse-client-test/main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99

1010
type argv struct {
1111
n, m int
12+
tagsNum int
1213
maxStrLen int
1314
viewCode bool
1415
keepTemp bool
@@ -22,6 +23,7 @@ func main() {
2223
var args argv
2324
flag.IntVar(&args.n, "n", 100, "number of iterations")
2425
flag.IntVar(&args.m, "m", 300, "number of series to send per iteration")
26+
flag.IntVar(&args.tagsNum, "tags", 16, "number of tags to use")
2527
flag.IntVar(&args.maxStrLen, "max-str-len", 32, "maximum string length")
2628
flag.BoolVar(&args.viewCode, "view-code", false, "open generated source files in Visual Studio Code")
2729
flag.BoolVar(&args.keepTemp, "keep-temp", false, "do not remove generated temporary files")

cmd/statshouse-client-test/test_data.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
"strings"
1414
"time"
1515

16-
"github.com/vkcom/statshouse/internal/format"
1716
"pgregory.net/rand"
1817
)
1918

@@ -54,9 +53,9 @@ func newTestData(args argv) testData {
5453
m.Timestamp = r.Uint32n(now)
5554
}
5655
m.Name = string(str[:rand.Intn(len(str)-1)+1])
57-
m.Tags = make([][2]string, r.Intn(format.MaxTags))
58-
for i, j := r.Intn(format.MaxTags), 0; j < len(m.Tags); i, j = i+1, j+1 {
59-
m.Tags[j] = [2]string{strconv.Itoa(i % format.MaxTags), string(str[:rand.Intn(len(str)-1)+1])}
56+
m.Tags = make([][2]string, r.Intn(args.tagsNum))
57+
for i, j := r.Intn(args.tagsNum), 0; j < len(m.Tags); i, j = i+1, j+1 {
58+
m.Tags[j] = [2]string{strconv.Itoa(i % args.tagsNum), string(str[:rand.Intn(len(str)-1)+1])}
6059
}
6160
m.Kind = r.Intn(3)
6261
switch m.Kind {

0 commit comments

Comments
 (0)