Skip to content

Commit 7124713

Browse files
use different db for different tests
1 parent 0c3b5ab commit 7124713

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Tests/PowerSyncGRDBTests/BasicTest.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ final class GRDBTests: XCTestCase {
4747

4848
override func setUp() async throws {
4949
try await super.setUp()
50+
51+
// Use a unique identifier per test instance to avoid conflicts during parallel test execution
52+
let dbIdentifier = "test-\(UUID().uuidString).sqlite"
53+
5054
schema = Schema(tables: [
5155
Table(name: "users", columns: [
5256
.text("name")
@@ -73,7 +77,7 @@ final class GRDBTests: XCTestCase {
7377
// Ensure the documents directory exists
7478
try FileManager.default.createDirectory(at: documentsDir, withIntermediateDirectories: true, attributes: nil)
7579

76-
let dbURL = documentsDir.appendingPathComponent("test.sqlite")
80+
let dbURL = documentsDir.appendingPathComponent(dbIdentifier)
7781
pool = try DatabasePool(
7882
path: dbURL.path,
7983
configuration: config
@@ -82,7 +86,7 @@ final class GRDBTests: XCTestCase {
8286
database = openPowerSyncWithGRDB(
8387
pool: pool,
8488
schema: schema,
85-
identifier: "test.sqlite"
89+
identifier: dbIdentifier
8690
)
8791

8892
try await database.disconnectAndClear()

0 commit comments

Comments
 (0)