@@ -27,12 +27,11 @@ func startDB(t *testing.T) *utils.AhnlichProcess {
27
27
}
28
28
29
29
// Helper to dial the DB gRPC server
30
- func dialDB (t * testing.T , addr string ) * grpc.ClientConn {
31
- ctx , cancel := context .WithTimeout (context .Background (), 30 * time .Second )
32
- t .Cleanup (cancel )
30
+ func dialDB (t * testing.T , addr string ) (* grpc.ClientConn , context.CancelFunc ) {
31
+ ctx , cancel := context .WithTimeout (context .Background (), 60 * time .Second )
33
32
conn , err := grpc .DialContext (ctx , addr , grpc .WithInsecure (), grpc .WithBlock ())
34
33
require .NoError (t , err )
35
- return conn
34
+ return conn , cancel
36
35
}
37
36
38
37
// Shared test data
51
50
)
52
51
53
52
func TestCreateStore_Succeeds (t * testing.T ) {
53
+ t .Parallel ()
54
54
proc := startDB (t )
55
55
defer proc .Kill ()
56
- conn := dialDB (t , proc .ServerAddr )
56
+ conn , cancel := dialDB (t , proc .ServerAddr )
57
+ defer cancel ()
57
58
defer conn .Close ()
58
59
client := dbsvc .NewDBServiceClient (conn )
59
60
@@ -63,9 +64,11 @@ func TestCreateStore_Succeeds(t *testing.T) {
63
64
}
64
65
65
66
func TestCreateStoreWithPredicates_Succeeds (t * testing.T ) {
67
+ t .Parallel ()
66
68
proc := startDB (t )
67
69
defer proc .Kill ()
68
- conn := dialDB (t , proc .ServerAddr )
70
+ conn , cancel := dialDB (t , proc .ServerAddr )
71
+ defer cancel ()
69
72
defer conn .Close ()
70
73
client := dbsvc .NewDBServiceClient (conn )
71
74
@@ -75,9 +78,11 @@ func TestCreateStoreWithPredicates_Succeeds(t *testing.T) {
75
78
}
76
79
77
80
func TestListStores_FindsCreatedStore (t * testing.T ) {
81
+ t .Parallel ()
78
82
proc := startDB (t )
79
83
defer proc .Kill ()
80
- conn := dialDB (t , proc .ServerAddr )
84
+ conn , cancel := dialDB (t , proc .ServerAddr )
85
+ defer cancel ()
81
86
defer conn .Close ()
82
87
client := dbsvc .NewDBServiceClient (conn )
83
88
@@ -95,9 +100,11 @@ func TestListStores_FindsCreatedStore(t *testing.T) {
95
100
}
96
101
97
102
func TestSetInStore_Succeeds (t * testing.T ) {
103
+ t .Parallel ()
98
104
proc := startDB (t )
99
105
defer proc .Kill ()
100
- conn := dialDB (t , proc .ServerAddr )
106
+ conn , cancel := dialDB (t , proc .ServerAddr )
107
+ defer cancel ()
101
108
defer conn .Close ()
102
109
client := dbsvc .NewDBServiceClient (conn )
103
110
@@ -128,9 +135,11 @@ func TestSetInStore_Succeeds(t *testing.T) {
128
135
}
129
136
130
137
func TestSetInStore_SucceedsWithBinary (t * testing.T ) {
138
+ t .Parallel ()
131
139
proc := startDB (t )
132
140
defer proc .Kill ()
133
- conn := dialDB (t , proc .ServerAddr )
141
+ conn , cancel := dialDB (t , proc .ServerAddr )
142
+ defer cancel ()
134
143
defer conn .Close ()
135
144
client := dbsvc .NewDBServiceClient (conn )
136
145
@@ -152,9 +161,11 @@ func TestSetInStore_SucceedsWithBinary(t *testing.T) {
152
161
}
153
162
154
163
func TestCreatePredicateIndex_Succeeds (t * testing.T ) {
164
+ t .Parallel ()
155
165
proc := startDB (t )
156
166
defer proc .Kill ()
157
- conn := dialDB (t , proc .ServerAddr )
167
+ conn , cancel := dialDB (t , proc .ServerAddr )
168
+ defer cancel ()
158
169
defer conn .Close ()
159
170
client := dbsvc .NewDBServiceClient (conn )
160
171
_ , _ = client .CreateStore (context .Background (), storeWithPred )
@@ -168,9 +179,11 @@ func TestCreatePredicateIndex_Succeeds(t *testing.T) {
168
179
}
169
180
170
181
func TestGetByPredicate_Succeeds (t * testing.T ) {
182
+ t .Parallel ()
171
183
proc := startDB (t )
172
184
defer proc .Kill ()
173
- conn := dialDB (t , proc .ServerAddr )
185
+ conn , cancel := dialDB (t , proc .ServerAddr )
186
+ defer cancel ()
174
187
defer conn .Close ()
175
188
client := dbsvc .NewDBServiceClient (conn )
176
189
_ , _ = client .CreateStore (context .Background (), storeWithPred )
@@ -216,9 +229,11 @@ func TestGetByPredicate_Succeeds(t *testing.T) {
216
229
}
217
230
218
231
func TestGetSimN_Succeeds (t * testing.T ) {
232
+ t .Parallel ()
219
233
proc := startDB (t )
220
234
defer proc .Kill ()
221
- conn := dialDB (t , proc .ServerAddr )
235
+ conn , cancel := dialDB (t , proc .ServerAddr )
236
+ defer cancel ()
222
237
defer conn .Close ()
223
238
client := dbsvc .NewDBServiceClient (conn )
224
239
_ , _ = client .CreateStore (context .Background (), storeNoPred )
@@ -254,9 +269,11 @@ func TestGetSimN_Succeeds(t *testing.T) {
254
269
}
255
270
256
271
func TestDropPredicateIndex_Succeeds (t * testing.T ) {
272
+ t .Parallel ()
257
273
proc := startDB (t )
258
274
defer proc .Kill ()
259
- conn := dialDB (t , proc .ServerAddr )
275
+ conn , cancel := dialDB (t , proc .ServerAddr )
276
+ defer cancel ()
260
277
defer conn .Close ()
261
278
client := dbsvc .NewDBServiceClient (conn )
262
279
_ , _ = client .CreateStore (context .Background (), storeWithPred )
@@ -271,9 +288,11 @@ func TestDropPredicateIndex_Succeeds(t *testing.T) {
271
288
}
272
289
273
290
func TestDeletePredicate_Succeeds (t * testing.T ) {
291
+ t .Parallel ()
274
292
proc := startDB (t )
275
293
defer proc .Kill ()
276
- conn := dialDB (t , proc .ServerAddr )
294
+ conn , cancel := dialDB (t , proc .ServerAddr )
295
+ defer cancel ()
277
296
defer conn .Close ()
278
297
client := dbsvc .NewDBServiceClient (conn )
279
298
_ , _ = client .CreateStore (context .Background (), storeWithPred )
@@ -309,9 +328,11 @@ func TestDeletePredicate_Succeeds(t *testing.T) {
309
328
}
310
329
311
330
func TestDeleteKey_Succeeds (t * testing.T ) {
331
+ t .Parallel ()
312
332
proc := startDB (t )
313
333
defer proc .Kill ()
314
- conn := dialDB (t , proc .ServerAddr )
334
+ conn , cancel := dialDB (t , proc .ServerAddr )
335
+ defer cancel ()
315
336
defer conn .Close ()
316
337
client := dbsvc .NewDBServiceClient (conn )
317
338
_ , _ = client .CreateStore (context .Background (), storeNoPred )
@@ -338,9 +359,11 @@ func TestDeleteKey_Succeeds(t *testing.T) {
338
359
}
339
360
340
361
func TestDropStore_Succeeds (t * testing.T ) {
362
+ t .Parallel ()
341
363
proc := startDB (t )
342
364
defer proc .Kill ()
343
- conn := dialDB (t , proc .ServerAddr )
365
+ conn , cancel := dialDB (t , proc .ServerAddr )
366
+ defer cancel ()
344
367
defer conn .Close ()
345
368
client := dbsvc .NewDBServiceClient (conn )
346
369
_ , _ = client .CreateStore (context .Background (), storeNoPred )
@@ -351,9 +374,11 @@ func TestDropStore_Succeeds(t *testing.T) {
351
374
}
352
375
353
376
func TestListStores_ReflectsDroppedStore (t * testing.T ) {
377
+ t .Parallel ()
354
378
proc := startDB (t )
355
379
defer proc .Kill ()
356
- conn := dialDB (t , proc .ServerAddr )
380
+ conn , cancel := dialDB (t , proc .ServerAddr )
381
+ defer cancel ()
357
382
defer conn .Close ()
358
383
client := dbsvc .NewDBServiceClient (conn )
359
384
_ , _ = client .CreateStore (context .Background (), storeNoPred )
@@ -367,9 +392,11 @@ func TestListStores_ReflectsDroppedStore(t *testing.T) {
367
392
}
368
393
369
394
func TestPipeline_BulkSetAndGet (t * testing.T ) {
395
+ t .Parallel ()
370
396
proc := startDB (t )
371
397
defer proc .Kill ()
372
- conn := dialDB (t , proc .ServerAddr )
398
+ conn , cancel := dialDB (t , proc .ServerAddr )
399
+ defer cancel ()
373
400
defer conn .Close ()
374
401
client := dbsvc .NewDBServiceClient (conn )
375
402
_ , _ = client .CreateStore (context .Background (), storeNoPred )
0 commit comments