Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Tests/RAGKitTests/CoreDataVectorIndexTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,17 @@ final class CoreDataVectorIndexTests: XCTestCase {
at: directory,
withIntermediateDirectories: true
)
addTeardownBlock {
do {
try FileManager.default.removeItem(at: directory)
} catch {
XCTFail(
"RAGKit could not remove a temporary Core Data vector index test directory at \(directory.path). \(error.localizedDescription)",
file: file,
line: line
)
}
}
} catch {
XCTFail(
"RAGKit could not create a temporary Core Data vector index test directory. \(error.localizedDescription)",
Expand Down
16 changes: 16 additions & 0 deletions Tests/SwiftlyFetchTests/SwiftlyFetchLibraryTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,9 @@ struct SwiftlyFetchLibraryTests {
@Test("Persistent facade reopens conventional and semantic state")
func persistentFacadeReopensConventionalAndSemanticState() async throws {
let directory = try temporaryDirectory()
defer {
cleanupTemporaryDirectory(directory)
}

do {
let firstLibrary = try await SwiftlyFetchLibrary.macOSPersistentLibrary(at: directory)
Expand All @@ -332,6 +335,9 @@ struct SwiftlyFetchLibraryTests {
@Test("Core Data semantic retry store reopens pending retries")
func coreDataSemanticRetryStoreReopensPendingRetries() async throws {
let directory = try temporaryDirectory()
defer {
cleanupTemporaryDirectory(directory)
}
let storeURL = directory.appendingPathComponent("SemanticRetries.sqlite")
let olderDate = try #require(Calendar.current.date(from: DateComponents(year: 2026, month: 1, day: 1)))
let newerDate = try #require(Calendar.current.date(from: DateComponents(year: 2026, month: 1, day: 2)))
Expand Down Expand Up @@ -493,4 +499,14 @@ private func temporaryDirectory() throws -> URL {

return directory
}

private func cleanupTemporaryDirectory(_ directory: URL) {
do {
try FileManager.default.removeItem(at: directory)
} catch {
Issue.record(
"SwiftlyFetch could not remove a temporary test directory at \(directory.path). \(error.localizedDescription)"
)
}
}
#endif
Loading