Skip to content

Commit 2e5a5b8

Browse files
authored
Fix metadata check in interop tests (#39)
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
1 parent 35eba4e commit 2e5a5b8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Sources/GRPCInteropTests/InteroperabilityTestCases.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -707,13 +707,13 @@ struct CustomMetadata: InteroperabilityTest {
707707
let trailingMetadataValue: [UInt8] = [0xAB, 0xAB, 0xAB]
708708

709709
func checkInitialMetadata(_ metadata: Metadata) throws {
710-
let values = metadata[self.initialMetadataName]
711-
try assertEqual(Array(values), [.string(self.initialMetadataValue)])
710+
let values = metadata[stringValues: self.initialMetadataName]
711+
try assertEqual(Array(values), [self.initialMetadataValue])
712712
}
713713

714714
func checkTrailingMetadata(_ metadata: Metadata) throws {
715-
let values = metadata[self.trailingMetadataName]
716-
try assertEqual(Array(values), [.binary(self.trailingMetadataValue)])
715+
let values = metadata[binaryValues: self.trailingMetadataName]
716+
try assertEqual(Array(values), [self.trailingMetadataValue])
717717
}
718718

719719
func run<Transport: ClientTransport>(client: GRPCClient<Transport>) async throws {

0 commit comments

Comments
 (0)