@@ -30,11 +30,15 @@ import (
30
30
)
31
31
32
32
const (
33
- TestDuration = 15 * time .Second
34
33
TestNumberOfGoRoutines = 20
35
34
)
36
35
37
- func stressTest (ctx * TestContext , successfulExecutors []func (* TestContext ), failingExecutors []func (* TestContext )) {
36
+ func stressTest (
37
+ ctx * TestContext ,
38
+ successfulExecutors []func (* TestContext ),
39
+ failingExecutors []func (* TestContext ),
40
+ duration time.Duration ) {
41
+
38
42
successfulExecutorsLen := len (successfulExecutors )
39
43
failingExecutorsLen := len (failingExecutors )
40
44
@@ -59,7 +63,7 @@ func stressTest(ctx *TestContext, successfulExecutors []func(*TestContext), fail
59
63
}()
60
64
}
61
65
62
- time .Sleep (TestDuration )
66
+ time .Sleep (duration )
63
67
ctx .Stop ()
64
68
waiter .Wait ()
65
69
}
@@ -70,12 +74,14 @@ func main() {
70
74
user string
71
75
password string
72
76
causalClustering bool
77
+ duration int
73
78
)
74
79
75
80
flag .StringVar (& uri , "uri" , "bolt://localhost:7687" , "Database URI" )
76
81
flag .StringVar (& user , "user" , "neo4j" , "User name" )
77
82
flag .StringVar (& password , "password" , "pass" , "Password" )
78
83
flag .BoolVar (& causalClustering , "cluster" , false , "Causal clustering" )
84
+ flag .IntVar (& duration , "duration" , 30 , "Duration in seconds" )
79
85
flag .Parse ()
80
86
81
87
auth := neo4j .BasicAuth (user , password , "" )
@@ -135,6 +141,8 @@ func main() {
135
141
)
136
142
}
137
143
138
- stressTest (ctx , successfulQueryExecutors , failingQueryExecutors )
144
+ stressTest (
145
+ ctx , successfulQueryExecutors , failingQueryExecutors ,
146
+ time .Duration (duration )* time .Second )
139
147
ctx .PrintStats ()
140
148
}
0 commit comments