Skip to content

Commit

Permalink
Update FunctionsTests.swift
Browse files Browse the repository at this point in the history
Revert func to non DISPACTCH.
Will work on a fix with @ncooke3
  • Loading branch information
eBlender committed Jan 16, 2025
1 parent fd68f01 commit f27bf07
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions FirebaseFunctions/Tests/Unit/FunctionsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,7 @@ class FunctionsTests: XCTestCase {
func testGenerateStreamContent() async throws {
let options = HTTPSCallableOptions(requireLimitedUseAppCheckTokens: true)
var response = [String]()
let responseQueue = DispatchQueue(label: "responseQueue")


let input: [String: Any] = ["data": "Why is the sky blue"]
let stream = try await functions?.stream(
at: URL(string: "http://127.0.0.1:5001/demo-project/us-central1/genStream")!,
Expand All @@ -376,17 +375,13 @@ class FunctionsTests: XCTestCase {
for try await result in stream {

Check failure on line 375 in FirebaseFunctions/Tests/Unit/FunctionsTests.swift

View workflow job for this annotation

GitHub Actions / spm-unit (macos-15, Xcode_16.1, tvOS)

testGenerateStreamContent, failed: caught error: "Error Domain=NSURLErrorDomain Code=-1004 "Could not connect to the server." UserInfo={_kCFStreamErrorCodeKey=61, NSUnderlyingError=0x600000c669a0 {Error Domain=kCFErrorDomainCFNetwork Code=-1004 "(null)" UserInfo={_NSURLErrorNWPathKey=satisfied (Path is satisfied), interface: lo0, _kCFStreamErrorCodeKey=61, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <B52DD2D5-A10B-4106-BD91-83F678783A9B>.<1>, _NSURLErrorRelatedURLSessionTaskErrorKey=(

Check failure on line 375 in FirebaseFunctions/Tests/Unit/FunctionsTests.swift

View workflow job for this annotation

GitHub Actions / spm-unit (macos-15, Xcode_16.1, tvOS)

testGenerateStreamContent, failed: caught error: "Error Domain=NSURLErrorDomain Code=-1004 "Could not connect to the server." UserInfo={_kCFStreamErrorCodeKey=61, NSUnderlyingError=0x600000c5dd70 {Error Domain=kCFErrorDomainCFNetwork Code=-1004 "(null)" UserInfo={_NSURLErrorNWPathKey=satisfied (Path is satisfied), interface: lo0, _kCFStreamErrorCodeKey=61, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <D1BFDD9E-BD95-4B84-926F-BE487A77A270>.<1>, _NSURLErrorRelatedURLSessionTaskErrorKey=(

Check failure on line 375 in FirebaseFunctions/Tests/Unit/FunctionsTests.swift

View workflow job for this annotation

GitHub Actions / spm-unit (macos-15, Xcode_16.1, macOS)

testGenerateStreamContent, failed: caught error: "Error Domain=NSURLErrorDomain Code=-1004 "Could not connect to the server." UserInfo={_kCFStreamErrorCodeKey=61, NSUnderlyingError=0x600002257510 {Error Domain=kCFErrorDomainCFNetwork Code=-1004 "(null)" UserInfo={_NSURLErrorNWPathKey=satisfied (Path is satisfied), viable, interface: lo0, _kCFStreamErrorCodeKey=61, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <F88CDC42-1D40-4665-A506-04547CA0B7CC>.<1>, _NSURLErrorRelatedURLSessionTaskErrorKey=(

Check failure on line 375 in FirebaseFunctions/Tests/Unit/FunctionsTests.swift

View workflow job for this annotation

GitHub Actions / spm-unit (macos-15, Xcode_16.1, macOS)

testGenerateStreamContent, failed: caught error: "Error Domain=NSURLErrorDomain Code=-1004 "Could not connect to the server." UserInfo={_kCFStreamErrorCodeKey=61, NSUnderlyingError=0x60000174c480 {Error Domain=kCFErrorDomainCFNetwork Code=-1004 "(null)" UserInfo={_NSURLErrorNWPathKey=satisfied (Path is satisfied), viable, interface: lo0, _kCFStreamErrorCodeKey=61, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <180EEA13-1583-410B-A659-81D73CF28A6C>.<1>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
if let dataChunk = result.data as? NSDictionary {
for (key, value) in dataChunk {
responseQueue.sync {
response.append("\(key) \(value)")
response.append("\(key) \(value)")
}
}
} else {
// Last chunk is the concatenated result so we have to parse it as String else will
// fail.
if let dataString = result.data as? String {
responseQueue.sync {
response.append(dataString)
}
}
}
}
Expand Down

0 comments on commit f27bf07

Please sign in to comment.