From 222a82ff8e9aa0b84451c9cb8d8dcbb9e944773a Mon Sep 17 00:00:00 2001 From: George Barnett Date: Tue, 25 Feb 2025 10:43:54 +0000 Subject: [PATCH] Fix metadata check in interop tests Motivation: The custom-metadata interop tests checks the underlying element is a decoded `.binary` element. This is isn't guaranteed for binary metadata values as the transport may not decode them. The test should instead check that the _binary values_ for the key are as expected. Modifications: - Use `subscript(binaryValues:)` and `subscript(stringValues:)` Result: More correct test --- Sources/GRPCInteropTests/InteroperabilityTestCases.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Sources/GRPCInteropTests/InteroperabilityTestCases.swift b/Sources/GRPCInteropTests/InteroperabilityTestCases.swift index 150da29..cb65368 100644 --- a/Sources/GRPCInteropTests/InteroperabilityTestCases.swift +++ b/Sources/GRPCInteropTests/InteroperabilityTestCases.swift @@ -707,13 +707,13 @@ struct CustomMetadata: InteroperabilityTest { let trailingMetadataValue: [UInt8] = [0xAB, 0xAB, 0xAB] func checkInitialMetadata(_ metadata: Metadata) throws { - let values = metadata[self.initialMetadataName] - try assertEqual(Array(values), [.string(self.initialMetadataValue)]) + let values = metadata[stringValues: self.initialMetadataName] + try assertEqual(Array(values), [self.initialMetadataValue]) } func checkTrailingMetadata(_ metadata: Metadata) throws { - let values = metadata[self.trailingMetadataName] - try assertEqual(Array(values), [.binary(self.trailingMetadataValue)]) + let values = metadata[binaryValues: self.trailingMetadataName] + try assertEqual(Array(values), [self.trailingMetadataValue]) } func run(client: GRPCClient) async throws {