Skip to content

Commit 555b004

Browse files
authored
Make all tests discoverable on Linux (#1399)
Motivation: Test discovery on Linux relies on source code analysis. Tests in subclasses which do not explicitly redeclare each test are missed. As a result, a number of tests are not run on Linux. Modifications: - Explicitly redeclare tests in subclasses. Result: - Resolves #1392
1 parent edcd6b9 commit 555b004

File tree

3 files changed

+334
-20
lines changed

3 files changed

+334
-20
lines changed

Tests/GRPCTests/FunctionalTests.swift

Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,12 +259,108 @@ class FunctionalTestsAnonymousClient: FunctionalTestsInsecureTransport {
259259
override var transportSecurity: TransportSecurity {
260260
return .anonymousClient
261261
}
262+
263+
override func testUnary() throws {
264+
try super.testUnary()
265+
}
266+
267+
override func testUnaryLotsOfRequests() throws {
268+
try super.testUnaryLotsOfRequests()
269+
}
270+
271+
override func testUnaryWithLargeData() throws {
272+
try super.testUnaryWithLargeData()
273+
}
274+
275+
override func testUnaryEmptyRequest() throws {
276+
try super.testUnaryEmptyRequest()
277+
}
278+
279+
override func testClientStreaming() {
280+
super.testClientStreaming()
281+
}
282+
283+
override func testClientStreamingLotsOfMessages() throws {
284+
try super.testClientStreamingLotsOfMessages()
285+
}
286+
287+
override func testServerStreaming() {
288+
super.testServerStreaming()
289+
}
290+
291+
override func testServerStreamingLotsOfMessages() {
292+
super.testServerStreamingLotsOfMessages()
293+
}
294+
295+
override func testBidirectionalStreamingBatched() throws {
296+
try super.testBidirectionalStreamingBatched()
297+
}
298+
299+
override func testBidirectionalStreamingPingPong() throws {
300+
try super.testBidirectionalStreamingPingPong()
301+
}
302+
303+
override func testBidirectionalStreamingLotsOfMessagesBatched() throws {
304+
try super.testBidirectionalStreamingLotsOfMessagesBatched()
305+
}
306+
307+
override func testBidirectionalStreamingLotsOfMessagesPingPong() throws {
308+
try super.testBidirectionalStreamingLotsOfMessagesPingPong()
309+
}
262310
}
263311

264312
class FunctionalTestsMutualAuthentication: FunctionalTestsInsecureTransport {
265313
override var transportSecurity: TransportSecurity {
266314
return .mutualAuthentication
267315
}
316+
317+
override func testUnary() throws {
318+
try super.testUnary()
319+
}
320+
321+
override func testUnaryLotsOfRequests() throws {
322+
try super.testUnaryLotsOfRequests()
323+
}
324+
325+
override func testUnaryWithLargeData() throws {
326+
try super.testUnaryWithLargeData()
327+
}
328+
329+
override func testUnaryEmptyRequest() throws {
330+
try super.testUnaryEmptyRequest()
331+
}
332+
333+
override func testClientStreaming() {
334+
super.testClientStreaming()
335+
}
336+
337+
override func testClientStreamingLotsOfMessages() throws {
338+
try super.testClientStreamingLotsOfMessages()
339+
}
340+
341+
override func testServerStreaming() {
342+
super.testServerStreaming()
343+
}
344+
345+
override func testServerStreamingLotsOfMessages() {
346+
super.testServerStreamingLotsOfMessages()
347+
}
348+
349+
override func testBidirectionalStreamingBatched() throws {
350+
try super.testBidirectionalStreamingBatched()
351+
}
352+
353+
override func testBidirectionalStreamingPingPong() throws {
354+
try super.testBidirectionalStreamingPingPong()
355+
}
356+
357+
override func testBidirectionalStreamingLotsOfMessagesBatched() throws {
358+
try super.testBidirectionalStreamingLotsOfMessagesBatched()
359+
}
360+
361+
override func testBidirectionalStreamingLotsOfMessagesPingPong() throws {
362+
try super.testBidirectionalStreamingLotsOfMessagesPingPong()
363+
}
268364
}
269365
#endif // canImport(NIOSSL)
270366

@@ -364,12 +460,108 @@ class FunctionalTestsAnonymousClientNIOTS: FunctionalTestsInsecureTransportNIOTS
364460
override var transportSecurity: TransportSecurity {
365461
return .anonymousClient
366462
}
463+
464+
override func testUnary() throws {
465+
try super.testUnary()
466+
}
467+
468+
override func testUnaryLotsOfRequests() throws {
469+
try super.testUnaryLotsOfRequests()
470+
}
471+
472+
override func testUnaryWithLargeData() throws {
473+
try super.testUnaryWithLargeData()
474+
}
475+
476+
override func testUnaryEmptyRequest() throws {
477+
try super.testUnaryEmptyRequest()
478+
}
479+
480+
override func testClientStreaming() {
481+
super.testClientStreaming()
482+
}
483+
484+
override func testClientStreamingLotsOfMessages() throws {
485+
try super.testClientStreamingLotsOfMessages()
486+
}
487+
488+
override func testServerStreaming() {
489+
super.testServerStreaming()
490+
}
491+
492+
override func testServerStreamingLotsOfMessages() {
493+
super.testServerStreamingLotsOfMessages()
494+
}
495+
496+
override func testBidirectionalStreamingBatched() throws {
497+
try super.testBidirectionalStreamingBatched()
498+
}
499+
500+
override func testBidirectionalStreamingPingPong() throws {
501+
try super.testBidirectionalStreamingPingPong()
502+
}
503+
504+
override func testBidirectionalStreamingLotsOfMessagesBatched() throws {
505+
try super.testBidirectionalStreamingLotsOfMessagesBatched()
506+
}
507+
508+
override func testBidirectionalStreamingLotsOfMessagesPingPong() throws {
509+
try super.testBidirectionalStreamingLotsOfMessagesPingPong()
510+
}
367511
}
368512

369513
@available(OSX 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *)
370514
class FunctionalTestsMutualAuthenticationNIOTS: FunctionalTestsInsecureTransportNIOTS {
371515
override var transportSecurity: TransportSecurity {
372516
return .mutualAuthentication
373517
}
518+
519+
override func testUnary() throws {
520+
try super.testUnary()
521+
}
522+
523+
override func testUnaryLotsOfRequests() throws {
524+
try super.testUnaryLotsOfRequests()
525+
}
526+
527+
override func testUnaryWithLargeData() throws {
528+
try super.testUnaryWithLargeData()
529+
}
530+
531+
override func testUnaryEmptyRequest() throws {
532+
try super.testUnaryEmptyRequest()
533+
}
534+
535+
override func testClientStreaming() {
536+
super.testClientStreaming()
537+
}
538+
539+
override func testClientStreamingLotsOfMessages() throws {
540+
try super.testClientStreamingLotsOfMessages()
541+
}
542+
543+
override func testServerStreaming() {
544+
super.testServerStreaming()
545+
}
546+
547+
override func testServerStreamingLotsOfMessages() {
548+
super.testServerStreamingLotsOfMessages()
549+
}
550+
551+
override func testBidirectionalStreamingBatched() throws {
552+
try super.testBidirectionalStreamingBatched()
553+
}
554+
555+
override func testBidirectionalStreamingPingPong() throws {
556+
try super.testBidirectionalStreamingPingPong()
557+
}
558+
559+
override func testBidirectionalStreamingLotsOfMessagesBatched() throws {
560+
try super.testBidirectionalStreamingLotsOfMessagesBatched()
561+
}
562+
563+
override func testBidirectionalStreamingLotsOfMessagesPingPong() throws {
564+
try super.testBidirectionalStreamingLotsOfMessagesPingPong()
565+
}
374566
}
375567
#endif // canImport(NIOSSL)

Tests/GRPCTests/GRPCInteroperabilityTests.swift

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,5 +168,81 @@ class GRPCInsecureInteroperabilityTests: GRPCTestCase {
168168
#if canImport(NIOSSL)
169169
class GRPCSecureInteroperabilityTests: GRPCInsecureInteroperabilityTests {
170170
override var useTLS: Bool { return true }
171+
172+
override func testEmptyUnary() {
173+
super.testEmptyUnary()
174+
}
175+
176+
override func testCacheableUnary() {
177+
super.testCacheableUnary()
178+
}
179+
180+
override func testLargeUnary() {
181+
super.testLargeUnary()
182+
}
183+
184+
override func testClientCompressedUnary() {
185+
super.testClientCompressedUnary()
186+
}
187+
188+
override func testServerCompressedUnary() {
189+
super.testServerCompressedUnary()
190+
}
191+
192+
override func testClientStreaming() {
193+
super.testClientStreaming()
194+
}
195+
196+
override func testClientCompressedStreaming() {
197+
super.testClientCompressedStreaming()
198+
}
199+
200+
override func testServerStreaming() {
201+
super.testServerStreaming()
202+
}
203+
204+
override func testServerCompressedStreaming() {
205+
super.testServerCompressedStreaming()
206+
}
207+
208+
override func testPingPong() {
209+
super.testPingPong()
210+
}
211+
212+
override func testEmptyStream() {
213+
super.testEmptyStream()
214+
}
215+
216+
override func testCustomMetadata() {
217+
super.testCustomMetadata()
218+
}
219+
220+
override func testStatusCodeAndMessage() {
221+
super.testStatusCodeAndMessage()
222+
}
223+
224+
override func testSpecialStatusAndMessage() {
225+
super.testSpecialStatusAndMessage()
226+
}
227+
228+
override func testUnimplementedMethod() {
229+
super.testUnimplementedMethod()
230+
}
231+
232+
override func testUnimplementedService() {
233+
super.testUnimplementedService()
234+
}
235+
236+
override func testCancelAfterBegin() {
237+
super.testCancelAfterBegin()
238+
}
239+
240+
override func testCancelAfterFirstResponse() {
241+
super.testCancelAfterFirstResponse()
242+
}
243+
244+
override func testTimeoutOnSleepingServer() {
245+
super.testTimeoutOnSleepingServer()
246+
}
171247
}
172248
#endif // canImport(NIOSSL)

Tests/GRPCTests/ServerThrowingTests.swift

Lines changed: 66 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -139,27 +139,7 @@ class ServerThrowingTests: EchoTestCaseBase {
139139
}
140140

141141
override func makeEchoProvider() -> Echo_EchoProvider { return ImmediateThrowingEchoProvider() }
142-
}
143-
144-
class ServerDelayedThrowingTests: ServerThrowingTests {
145-
override func makeEchoProvider() -> Echo_EchoProvider { return DelayedThrowingEchoProvider() }
146-
}
147-
148-
class ClientThrowingWhenServerReturningErrorTests: ServerThrowingTests {
149-
override func makeEchoProvider() -> Echo_EchoProvider { return ErrorReturningEchoProvider() }
150-
}
151-
152-
class ServerErrorTransformingTests: ServerThrowingTests {
153-
override var expectedError: GRPCStatus { return transformedError }
154-
override var expectedMetadata: HPACKHeaders? {
155-
return HPACKHeaders([("grpc-status", "10"), ("grpc-message", "transformed error"),
156-
("transformed", "header")])
157-
}
158142

159-
override func makeErrorDelegate() -> ServerErrorDelegate? { return ErrorTransformingDelegate() }
160-
}
161-
162-
extension ServerThrowingTests {
163143
func testUnary() throws {
164144
let call = client.get(Echo_EchoRequest(text: "foo"))
165145
XCTAssertEqual(self.expectedError, try call.status.wait())
@@ -222,3 +202,69 @@ extension ServerThrowingTests {
222202
}
223203
}
224204
}
205+
206+
class ServerDelayedThrowingTests: ServerThrowingTests {
207+
override func makeEchoProvider() -> Echo_EchoProvider { return DelayedThrowingEchoProvider() }
208+
209+
override func testUnary() throws {
210+
try super.testUnary()
211+
}
212+
213+
override func testClientStreaming() throws {
214+
try super.testClientStreaming()
215+
}
216+
217+
override func testServerStreaming() throws {
218+
try super.testServerStreaming()
219+
}
220+
221+
override func testBidirectionalStreaming() throws {
222+
try super.testBidirectionalStreaming()
223+
}
224+
}
225+
226+
class ClientThrowingWhenServerReturningErrorTests: ServerThrowingTests {
227+
override func makeEchoProvider() -> Echo_EchoProvider { return ErrorReturningEchoProvider() }
228+
229+
override func testUnary() throws {
230+
try super.testUnary()
231+
}
232+
233+
override func testClientStreaming() throws {
234+
try super.testClientStreaming()
235+
}
236+
237+
override func testServerStreaming() throws {
238+
try super.testServerStreaming()
239+
}
240+
241+
override func testBidirectionalStreaming() throws {
242+
try super.testBidirectionalStreaming()
243+
}
244+
}
245+
246+
class ServerErrorTransformingTests: ServerThrowingTests {
247+
override var expectedError: GRPCStatus { return transformedError }
248+
override var expectedMetadata: HPACKHeaders? {
249+
return HPACKHeaders([("grpc-status", "10"), ("grpc-message", "transformed error"),
250+
("transformed", "header")])
251+
}
252+
253+
override func makeErrorDelegate() -> ServerErrorDelegate? { return ErrorTransformingDelegate() }
254+
255+
override func testUnary() throws {
256+
try super.testUnary()
257+
}
258+
259+
override func testClientStreaming() throws {
260+
try super.testClientStreaming()
261+
}
262+
263+
override func testServerStreaming() throws {
264+
try super.testServerStreaming()
265+
}
266+
267+
override func testBidirectionalStreaming() throws {
268+
try super.testBidirectionalStreaming()
269+
}
270+
}

0 commit comments

Comments
 (0)