Skip to content

Commit

Permalink
apacheGH-37744: [Swift] Add test for arrow flight doGet FlightData
Browse files Browse the repository at this point in the history
  • Loading branch information
abandy committed Sep 15, 2023
1 parent e32e875 commit ef9e372
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions swift/ArrowFlight/Tests/ArrowFlightTests/FlightTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,25 @@ public class FlightClientTester {
XCTAssertEqual(num_call, 1)
}

func doGetTestFlightData() async throws {
let ticket = FlightTicket("flight_ticket test".data(using: .utf8)!)
var num_call = 0
try await client?.doGet(ticket, flightDataClosure: { flightData in
let reader = ArrowReader();
let result = reader.fromStream(flightData.dataBody)
switch result {
case .success(let rb):
XCTAssertEqual(rb.schema?.fields.count, 3)
XCTAssertEqual(rb.batches[0].length, 4)
num_call += 1
case .failure(let error):
throw error
}
})

XCTAssertEqual(num_call, 1)
}

func doPutTest() async throws {
let rb = try makeRecordBatch()
var num_call = 0
Expand Down Expand Up @@ -290,6 +309,7 @@ final class FlightTest: XCTestCase {
try await clientImpl.doActionTest()
try await clientImpl.getSchemaTest()
try await clientImpl.doGetTest()
try await clientImpl.doGetTestFlightData()
try await clientImpl.doPutTest()
try await clientImpl.doExchangeTest()

Expand Down

0 comments on commit ef9e372

Please sign in to comment.