@@ -208,12 +208,18 @@ class FieldExecutionStrategyTests: XCTestCase {
208
208
seconds: seconds
209
209
)
210
210
}
211
+
212
+ private var eventLoopGroup : EventLoopGroup !
213
+
214
+ override func setUp( ) {
215
+ eventLoopGroup = MultiThreadedEventLoopGroup ( numberOfThreads: 1 )
216
+ }
217
+
218
+ override func tearDown( ) {
219
+ XCTAssertNoThrow ( try eventLoopGroup. syncShutdownGracefully ( ) )
220
+ }
211
221
212
222
func testSerialFieldExecutionStrategyWithSingleField( ) throws {
213
- let eventLoopGroup = MultiThreadedEventLoopGroup ( numThreads: 1 )
214
- defer {
215
- XCTAssertNoThrow ( try eventLoopGroup. syncShutdownGracefully ( ) )
216
- }
217
223
218
224
let result = try timing ( try graphql (
219
225
queryStrategy: SerialFieldExecutionStrategy ( ) ,
@@ -226,11 +232,7 @@ class FieldExecutionStrategyTests: XCTestCase {
226
232
}
227
233
228
234
func testSerialFieldExecutionStrategyWithSingleFieldError( ) throws {
229
- let eventLoopGroup = MultiThreadedEventLoopGroup ( numThreads: 1 )
230
- defer {
231
- XCTAssertNoThrow ( try eventLoopGroup. syncShutdownGracefully ( ) )
232
- }
233
-
235
+
234
236
let result = try timing ( try graphql (
235
237
queryStrategy: SerialFieldExecutionStrategy ( ) ,
236
238
schema: schema,
@@ -242,10 +244,6 @@ class FieldExecutionStrategyTests: XCTestCase {
242
244
}
243
245
244
246
func testSerialFieldExecutionStrategyWithSingleFieldFailedFuture( ) throws {
245
- let eventLoopGroup = MultiThreadedEventLoopGroup ( numThreads: 1 )
246
- defer {
247
- XCTAssertNoThrow ( try eventLoopGroup. syncShutdownGracefully ( ) )
248
- }
249
247
250
248
let result = try timing ( try graphql (
251
249
queryStrategy: SerialFieldExecutionStrategy ( ) ,
@@ -258,10 +256,6 @@ class FieldExecutionStrategyTests: XCTestCase {
258
256
}
259
257
260
258
func testSerialFieldExecutionStrategyWithMultipleFields( ) throws {
261
- let eventLoopGroup = MultiThreadedEventLoopGroup ( numThreads: 1 )
262
- defer {
263
- XCTAssertNoThrow ( try eventLoopGroup. syncShutdownGracefully ( ) )
264
- }
265
259
266
260
let result = try timing ( try graphql (
267
261
queryStrategy: SerialFieldExecutionStrategy ( ) ,
@@ -274,10 +268,6 @@ class FieldExecutionStrategyTests: XCTestCase {
274
268
}
275
269
276
270
func testSerialFieldExecutionStrategyWithMultipleFieldErrors( ) throws {
277
- let eventLoopGroup = MultiThreadedEventLoopGroup ( numThreads: 1 )
278
- defer {
279
- XCTAssertNoThrow ( try eventLoopGroup. syncShutdownGracefully ( ) )
280
- }
281
271
282
272
let result = try timing ( try graphql (
283
273
queryStrategy: SerialFieldExecutionStrategy ( ) ,
@@ -295,10 +285,6 @@ class FieldExecutionStrategyTests: XCTestCase {
295
285
}
296
286
297
287
func testConcurrentDispatchFieldExecutionStrategyWithSingleField( ) throws {
298
- let eventLoopGroup = MultiThreadedEventLoopGroup ( numThreads: 1 )
299
- defer {
300
- XCTAssertNoThrow ( try eventLoopGroup. syncShutdownGracefully ( ) )
301
- }
302
288
303
289
let result = try timing ( try graphql (
304
290
queryStrategy: ConcurrentDispatchFieldExecutionStrategy ( ) ,
@@ -311,10 +297,6 @@ class FieldExecutionStrategyTests: XCTestCase {
311
297
}
312
298
313
299
func testConcurrentDispatchFieldExecutionStrategyWithSingleFieldError( ) throws {
314
- let eventLoopGroup = MultiThreadedEventLoopGroup ( numThreads: 1 )
315
- defer {
316
- XCTAssertNoThrow ( try eventLoopGroup. syncShutdownGracefully ( ) )
317
- }
318
300
319
301
let result = try timing ( try graphql (
320
302
queryStrategy: ConcurrentDispatchFieldExecutionStrategy ( ) ,
@@ -327,10 +309,6 @@ class FieldExecutionStrategyTests: XCTestCase {
327
309
}
328
310
329
311
func testConcurrentDispatchFieldExecutionStrategyWithMultipleFields( ) throws {
330
- let eventLoopGroup = MultiThreadedEventLoopGroup ( numThreads: 1 )
331
- defer {
332
- XCTAssertNoThrow ( try eventLoopGroup. syncShutdownGracefully ( ) )
333
- }
334
312
335
313
let result = try timing ( try graphql (
336
314
queryStrategy: ConcurrentDispatchFieldExecutionStrategy ( ) ,
@@ -343,10 +321,6 @@ class FieldExecutionStrategyTests: XCTestCase {
343
321
}
344
322
345
323
func testConcurrentDispatchFieldExecutionStrategyWithMultipleFieldErrors( ) throws {
346
- let eventLoopGroup = MultiThreadedEventLoopGroup ( numThreads: 1 )
347
- defer {
348
- XCTAssertNoThrow ( try eventLoopGroup. syncShutdownGracefully ( ) )
349
- }
350
324
351
325
let result = try timing ( try graphql (
352
326
queryStrategy: ConcurrentDispatchFieldExecutionStrategy ( ) ,
0 commit comments