Skip to content

Commit 481feec

Browse files
authored
Add support for deflate to interop test case (#45)
We're currently using only `gzip` for the client compressed unary interop test. Wouldn't hurt to also run it using deflate.
1 parent be9dd92 commit 481feec

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

Sources/GRPCInteropTests/InteroperabilityTestCases.swift

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -174,17 +174,18 @@ class ClientCompressedUnary: InteroperabilityTest {
174174
}
175175

176176
// With compression expected and enabled.
177-
options.compression = .gzip
178-
179-
try await testServiceClient.unaryCall(
180-
request: ClientRequest(message: compressedRequest),
181-
options: options
182-
) { response in
183-
switch response.accepted {
184-
case .success(let success):
185-
try assertEqual(success.message.get().payload.body, Data(repeating: 0, count: 314_159))
186-
case .failure:
187-
throw AssertionFailure(message: "Response should have been accepted.")
177+
for algorithm in [CompressionAlgorithm.gzip, .deflate] {
178+
options.compression = algorithm
179+
try await testServiceClient.unaryCall(
180+
request: ClientRequest(message: compressedRequest),
181+
options: options
182+
) { response in
183+
switch response.accepted {
184+
case .success(let success):
185+
try assertEqual(success.message.get().payload.body, Data(repeating: 0, count: 314_159))
186+
case .failure:
187+
throw AssertionFailure(message: "Response should have been accepted.")
188+
}
188189
}
189190
}
190191

@@ -266,7 +267,7 @@ class ServerCompressedUnary: InteroperabilityTest {
266267
request: ClientRequest(message: compressedRequest)
267268
) { response in
268269
// We can't verify that the compression bit was set, instead we verify that the encoding header
269-
// was sent by the server. This isn't quite the same since as it can still be set but the
270+
// was sent by the server. This isn't quite the same as it can still be set but the
270271
// compression may _not_ be set.
271272
try assertTrue(response.metadata["grpc-encoding"].contains { $0 != "identity" })
272273

0 commit comments

Comments
 (0)