@@ -208,12 +208,18 @@ class FieldExecutionStrategyTests: XCTestCase {
208208 seconds: seconds
209209 )
210210 }
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+ }
211221
212222 func testSerialFieldExecutionStrategyWithSingleField( ) throws {
213- let eventLoopGroup = MultiThreadedEventLoopGroup ( numThreads: 1 )
214- defer {
215- XCTAssertNoThrow ( try eventLoopGroup. syncShutdownGracefully ( ) )
216- }
217223
218224 let result = try timing ( try graphql (
219225 queryStrategy: SerialFieldExecutionStrategy ( ) ,
@@ -226,11 +232,7 @@ class FieldExecutionStrategyTests: XCTestCase {
226232 }
227233
228234 func testSerialFieldExecutionStrategyWithSingleFieldError( ) throws {
229- let eventLoopGroup = MultiThreadedEventLoopGroup ( numThreads: 1 )
230- defer {
231- XCTAssertNoThrow ( try eventLoopGroup. syncShutdownGracefully ( ) )
232- }
233-
235+
234236 let result = try timing ( try graphql (
235237 queryStrategy: SerialFieldExecutionStrategy ( ) ,
236238 schema: schema,
@@ -242,10 +244,6 @@ class FieldExecutionStrategyTests: XCTestCase {
242244 }
243245
244246 func testSerialFieldExecutionStrategyWithSingleFieldFailedFuture( ) throws {
245- let eventLoopGroup = MultiThreadedEventLoopGroup ( numThreads: 1 )
246- defer {
247- XCTAssertNoThrow ( try eventLoopGroup. syncShutdownGracefully ( ) )
248- }
249247
250248 let result = try timing ( try graphql (
251249 queryStrategy: SerialFieldExecutionStrategy ( ) ,
@@ -258,10 +256,6 @@ class FieldExecutionStrategyTests: XCTestCase {
258256 }
259257
260258 func testSerialFieldExecutionStrategyWithMultipleFields( ) throws {
261- let eventLoopGroup = MultiThreadedEventLoopGroup ( numThreads: 1 )
262- defer {
263- XCTAssertNoThrow ( try eventLoopGroup. syncShutdownGracefully ( ) )
264- }
265259
266260 let result = try timing ( try graphql (
267261 queryStrategy: SerialFieldExecutionStrategy ( ) ,
@@ -274,10 +268,6 @@ class FieldExecutionStrategyTests: XCTestCase {
274268 }
275269
276270 func testSerialFieldExecutionStrategyWithMultipleFieldErrors( ) throws {
277- let eventLoopGroup = MultiThreadedEventLoopGroup ( numThreads: 1 )
278- defer {
279- XCTAssertNoThrow ( try eventLoopGroup. syncShutdownGracefully ( ) )
280- }
281271
282272 let result = try timing ( try graphql (
283273 queryStrategy: SerialFieldExecutionStrategy ( ) ,
@@ -295,10 +285,6 @@ class FieldExecutionStrategyTests: XCTestCase {
295285 }
296286
297287 func testConcurrentDispatchFieldExecutionStrategyWithSingleField( ) throws {
298- let eventLoopGroup = MultiThreadedEventLoopGroup ( numThreads: 1 )
299- defer {
300- XCTAssertNoThrow ( try eventLoopGroup. syncShutdownGracefully ( ) )
301- }
302288
303289 let result = try timing ( try graphql (
304290 queryStrategy: ConcurrentDispatchFieldExecutionStrategy ( ) ,
@@ -311,10 +297,6 @@ class FieldExecutionStrategyTests: XCTestCase {
311297 }
312298
313299 func testConcurrentDispatchFieldExecutionStrategyWithSingleFieldError( ) throws {
314- let eventLoopGroup = MultiThreadedEventLoopGroup ( numThreads: 1 )
315- defer {
316- XCTAssertNoThrow ( try eventLoopGroup. syncShutdownGracefully ( ) )
317- }
318300
319301 let result = try timing ( try graphql (
320302 queryStrategy: ConcurrentDispatchFieldExecutionStrategy ( ) ,
@@ -327,10 +309,6 @@ class FieldExecutionStrategyTests: XCTestCase {
327309 }
328310
329311 func testConcurrentDispatchFieldExecutionStrategyWithMultipleFields( ) throws {
330- let eventLoopGroup = MultiThreadedEventLoopGroup ( numThreads: 1 )
331- defer {
332- XCTAssertNoThrow ( try eventLoopGroup. syncShutdownGracefully ( ) )
333- }
334312
335313 let result = try timing ( try graphql (
336314 queryStrategy: ConcurrentDispatchFieldExecutionStrategy ( ) ,
@@ -343,10 +321,6 @@ class FieldExecutionStrategyTests: XCTestCase {
343321 }
344322
345323 func testConcurrentDispatchFieldExecutionStrategyWithMultipleFieldErrors( ) throws {
346- let eventLoopGroup = MultiThreadedEventLoopGroup ( numThreads: 1 )
347- defer {
348- XCTAssertNoThrow ( try eventLoopGroup. syncShutdownGracefully ( ) )
349- }
350324
351325 let result = try timing ( try graphql (
352326 queryStrategy: ConcurrentDispatchFieldExecutionStrategy ( ) ,
0 commit comments