Skip to content

Commit 7d227f7

Browse files
committed
Fix testing of concurrent assembly creation
1 parent ec314fe commit 7d227f7

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

Tests/TransloaditKitTests/TransloaditKitTests.swift

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,24 @@ class TransloaditKitTests: XCTestCase {
8989
}
9090

9191
func testConcurrentAssemblyCreation() throws {
92-
let (files, serverAssembly) = try Network.prepareForUploadingFiles(data: data)
93-
let numFiles = files.count
94-
92+
let expect = expectation(description: "Wait for all assemblies to be created")
93+
expect.expectedFulfillmentCount = 10
94+
9595
DispatchQueue.concurrentPerform(iterations: 10) { _ in
96-
let _ = createAssembly(files) { _ in }
96+
do {
97+
let (files, serverAssembly) = try Network.prepareForUploadingFiles(data: data)
98+
let numFiles = files.count
99+
let _ = createAssembly(files) { _ in
100+
expect.fulfill()
101+
}
102+
} catch {
103+
XCTFail("Failed with error \(error)")
104+
}
97105
}
106+
107+
wait(for: [expect], timeout: 10)
108+
109+
try transloadit.reset()
98110
}
99111

100112
func testCanReset() throws {

0 commit comments

Comments
 (0)