From f5788576ca3bfc136cb4b6e0a6eb66343bb6049b Mon Sep 17 00:00:00 2001 From: Gus Cairo Date: Mon, 12 May 2025 13:09:07 +0100 Subject: [PATCH] Add support for deflate to interop test case --- .../InteroperabilityTestCases.swift | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/Sources/GRPCInteropTests/InteroperabilityTestCases.swift b/Sources/GRPCInteropTests/InteroperabilityTestCases.swift index cb65368..4802763 100644 --- a/Sources/GRPCInteropTests/InteroperabilityTestCases.swift +++ b/Sources/GRPCInteropTests/InteroperabilityTestCases.swift @@ -174,17 +174,18 @@ class ClientCompressedUnary: InteroperabilityTest { } // With compression expected and enabled. - options.compression = .gzip - - try await testServiceClient.unaryCall( - request: ClientRequest(message: compressedRequest), - options: options - ) { response in - switch response.accepted { - case .success(let success): - try assertEqual(success.message.get().payload.body, Data(repeating: 0, count: 314_159)) - case .failure: - throw AssertionFailure(message: "Response should have been accepted.") + for algorithm in [CompressionAlgorithm.gzip, .deflate] { + options.compression = algorithm + try await testServiceClient.unaryCall( + request: ClientRequest(message: compressedRequest), + options: options + ) { response in + switch response.accepted { + case .success(let success): + try assertEqual(success.message.get().payload.body, Data(repeating: 0, count: 314_159)) + case .failure: + throw AssertionFailure(message: "Response should have been accepted.") + } } } @@ -266,7 +267,7 @@ class ServerCompressedUnary: InteroperabilityTest { request: ClientRequest(message: compressedRequest) ) { response in // We can't verify that the compression bit was set, instead we verify that the encoding header - // was sent by the server. This isn't quite the same since as it can still be set but the + // was sent by the server. This isn't quite the same as it can still be set but the // compression may _not_ be set. try assertTrue(response.metadata["grpc-encoding"].contains { $0 != "identity" })