-
Notifications
You must be signed in to change notification settings - Fork 115
/
cli_e2e_test.go
66 lines (58 loc) · 1.57 KB
/
cli_e2e_test.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//go:build e2e
package main
import (
"testing"
"time"
"go.uber.org/goleak"
"github.com/hatchet-dev/hatchet/internal/testutils"
)
func TestLoadCLI(t *testing.T) {
testutils.Prepare(t)
type args struct {
duration time.Duration
eventsPerSecond int
delay time.Duration
wait time.Duration
concurrency int
}
tests := []struct {
name string
args args
wantErr bool
}{{
name: "test simple with unlimited concurrency",
args: args{
duration: 10 * time.Second,
eventsPerSecond: 10,
delay: 0 * time.Second,
wait: 20 * time.Second,
concurrency: 0,
},
}, {
name: "test with high step delay",
args: args{
duration: 10 * time.Second,
eventsPerSecond: 10,
delay: 10 * time.Second,
wait: 30 * time.Second,
concurrency: 0,
},
}}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
defer func() {
time.Sleep(1 * time.Second)
goleak.VerifyNone(
t,
goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"),
goleak.IgnoreTopFunction("google.golang.org/grpc/internal/grpcsync.(*CallbackSerializer).run"),
goleak.IgnoreTopFunction("internal/poll.runtime_pollWait"),
goleak.IgnoreTopFunction("google.golang.org/grpc/internal/transport.(*controlBuffer).get"),
)
}()
if err := do(tt.args.duration, tt.args.eventsPerSecond, tt.args.delay, tt.args.wait, tt.args.concurrency); (err != nil) != tt.wantErr {
t.Errorf("do() error = %v, wantErr %v", err, tt.wantErr)
}
})
}
}