Skip to content

Commit 2762bab

Browse files
committed
Do not change the current directory
1 parent ff6dea3 commit 2762bab

1 file changed

Lines changed: 3 additions & 11 deletions

File tree

Tests/ContainerAPIClientTests/ParserTest.swift

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -329,11 +329,6 @@ struct ParserTest {
329329

330330
@Test
331331
func testRelativePaths() throws {
332-
let originalDir = FileManager.default.currentDirectoryPath
333-
defer {
334-
FileManager.default.changeCurrentDirectoryPath(originalDir)
335-
}
336-
337332
func realpath(_ path: String) -> String {
338333
let resolved = UnsafeMutablePointer<CChar>.allocate(capacity: Int(PATH_MAX))
339334
defer { resolved.deallocate() }
@@ -351,8 +346,7 @@ struct ParserTest {
351346
try? FileManager.default.removeItem(at: tempDir)
352347
}
353348

354-
FileManager.default.changeCurrentDirectoryPath(tempDir.path)
355-
let result = try Parser.mount("type=bind,src=.,dst=/foo")
349+
let result = try Parser.mount("type=bind,src=.,dst=/foo", relativeTo: tempDir)
356350

357351
switch result {
358352
case .filesystem(let fs):
@@ -372,8 +366,7 @@ struct ParserTest {
372366
try? FileManager.default.removeItem(at: tempDir)
373367
}
374368

375-
FileManager.default.changeCurrentDirectoryPath(tempDir.path)
376-
let result = try Parser.volume("./:/foo")
369+
let result = try Parser.volume("./:/foo", relativeTo: tempDir)
377370

378371
switch result {
379372
case .filesystem(let fs):
@@ -395,8 +388,7 @@ struct ParserTest {
395388
try? FileManager.default.removeItem(at: tempDir)
396389
}
397390

398-
FileManager.default.changeCurrentDirectoryPath(tempDir.path)
399-
let result = try Parser.volume("./subdir:/foo")
391+
let result = try Parser.volume("./subdir:/foo", relativeTo: tempDir)
400392

401393
switch result {
402394
case .filesystem(let fs):

0 commit comments

Comments
 (0)