Skip to content

Commit

Permalink
Fix testing of concurrent assembly creation
Browse files Browse the repository at this point in the history
  • Loading branch information
donnywals committed Jan 16, 2025
1 parent ec314fe commit 7d227f7
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions Tests/TransloaditKitTests/TransloaditKitTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,24 @@ class TransloaditKitTests: XCTestCase {
}

func testConcurrentAssemblyCreation() throws {
let (files, serverAssembly) = try Network.prepareForUploadingFiles(data: data)
let numFiles = files.count

let expect = expectation(description: "Wait for all assemblies to be created")
expect.expectedFulfillmentCount = 10
DispatchQueue.concurrentPerform(iterations: 10) { _ in
let _ = createAssembly(files) { _ in }
do {
let (files, serverAssembly) = try Network.prepareForUploadingFiles(data: data)
let numFiles = files.count
let _ = createAssembly(files) { _ in
expect.fulfill()
}
} catch {
XCTFail("Failed with error \(error)")
}
}

wait(for: [expect], timeout: 10)

try transloadit.reset()
}

func testCanReset() throws {
Expand Down

0 comments on commit 7d227f7

Please sign in to comment.