@@ -507,11 +507,7 @@ class AnalyzerTests: AppTestCase {
507507 Current . fileManager. fileExists = { @Sendable _ in true }
508508 let commands = QueueIsolated < [ String ] > ( [ ] )
509509 Current . shell. run = { @Sendable cmd, path in
510- // mask variable checkout
511- let checkoutDir = Current . fileManager. checkoutsDirectory ( )
512- commands. withValue {
513- $0. append ( cmd. description. replacingOccurrences ( of: checkoutDir, with: " ... " ) )
514- }
510+ commands. withValue { $0. append ( cmd. description) }
515511 return " "
516512 }
517513 let jpr = try await Package . fetchCandidate ( app. db, id: pkg. id!)
@@ -961,17 +957,13 @@ class AnalyzerTests: AppTestCase {
961957 try await savePackage ( on: app. db, " 1 " . asGithubUrl. url, processingStage: . ingestion)
962958 let pkgs = try await Package . fetchCandidates ( app. db, for: . analysis, limit: 10 )
963959
964- let checkoutDir = Current . fileManager. checkoutsDirectory ( )
965960 // claim every file exists, including our ficticious 'index.lock' for which
966961 // we want to trigger the cleanup mechanism
967962 Current . fileManager. fileExists = { @Sendable path in true }
968963
969964 let commands = QueueIsolated < [ String ] > ( [ ] )
970965 Current . shell. run = { @Sendable cmd, path in
971- commands. withValue {
972- let c = cmd. description. replacingOccurrences ( of: checkoutDir, with: " ... " )
973- $0. append ( c)
974- }
966+ commands. withValue { $0. append ( cmd. description) }
975967 return " "
976968 }
977969
@@ -995,17 +987,13 @@ class AnalyzerTests: AppTestCase {
995987 try await savePackage ( on: app. db, " 1 " . asGithubUrl. url, processingStage: . ingestion)
996988 let pkgs = try await Package . fetchCandidates ( app. db, for: . analysis, limit: 10 )
997989
998- let checkoutDir = Current . fileManager. checkoutsDirectory ( )
999990 // claim every file exists, including our ficticious 'index.lock' for which
1000991 // we want to trigger the cleanup mechanism
1001992 Current . fileManager. fileExists = { @Sendable path in true }
1002993
1003994 let commands = QueueIsolated < [ String ] > ( [ ] )
1004995 Current . shell. run = { @Sendable cmd, path in
1005- commands. withValue {
1006- let c = cmd. description. replacingOccurrences ( of: checkoutDir, with: " ${checkouts} " )
1007- $0. append ( c)
1008- }
996+ commands. withValue { $0. append ( cmd. description) }
1009997 if cmd == . gitCheckout( branch: " master " ) {
1010998 throw TestError . simulatedCheckoutError
1011999 }
@@ -1155,11 +1143,7 @@ class AnalyzerTests: AppTestCase {
11551143 Current . fileManager. fileExists = { @Sendable _ in true }
11561144 let commands = QueueIsolated < [ String ] > ( [ ] )
11571145 Current . shell. run = { @Sendable cmd, _ in
1158- commands. withValue {
1159- // mask variable checkout
1160- let checkoutDir = Current . fileManager. checkoutsDirectory ( )
1161- $0. append ( cmd. description. replacingOccurrences ( of: checkoutDir, with: " ... " ) )
1162- }
1146+ commands. withValue { $0. append ( cmd. description) }
11631147 if cmd == . gitFetchAndPruneTags { throw TestError . simulatedFetchError }
11641148 return " "
11651149 }
@@ -1235,6 +1219,7 @@ class AnalyzerTests: AppTestCase {
12351219 // Ensure we handle 404 repos properly
12361220 // https://github.com/SwiftPackageIndex/SwiftPackageIndex-Server/issues/914
12371221 // setup
1222+ let checkoutDir = " /checkouts "
12381223 do {
12391224 let url = " 1 " . asGithubUrl. url
12401225 let pkg = Package . init ( url: url, processingStage: . ingestion)
@@ -1243,13 +1228,13 @@ class AnalyzerTests: AppTestCase {
12431228 if path. hasSuffix ( " github.com-foo-1 " ) { return false }
12441229 return true
12451230 }
1246- let repoDir = try Current . fileManager . checkoutsDirectory ( ) + " / " + XCTUnwrap( pkg. cacheDirectoryName)
1231+ let repoDir = try checkoutDir + " / " + XCTUnwrap( pkg. cacheDirectoryName)
12471232 struct ShellOutError : Error { }
12481233 Current . shell. run = { @Sendable cmd, path in
12491234 if cmd == . gitClone( url: url, to: repoDir) {
12501235 throw ShellOutError ( )
12511236 }
1252- fatalError ( " should not be reached " )
1237+ throw TestError . unknownCommand
12531238 }
12541239 }
12551240 let lastUpdated = Date ( )
@@ -1268,16 +1253,16 @@ class AnalyzerTests: AppTestCase {
12681253 func test_trimCheckouts( ) throws {
12691254 try withDependencies {
12701255 $0. date. now = . t0
1271- } operation: {
1272- // setup
1273- Current . fileManager. checkoutsDirectory = { " /checkouts " }
1274- Current . fileManager. contentsOfDirectory = { @Sendable _ in [ " foo " , " bar " ] }
1275- Current . fileManager. attributesOfItem = { @Sendable path in
1256+ $0. fileManager. attributesOfItem = { @Sendable path in
12761257 [
12771258 " /checkouts/foo " : [ FileAttributeKey . modificationDate: Date . t0. adding ( days: - 31 ) ] ,
12781259 " /checkouts/bar " : [ FileAttributeKey . modificationDate: Date . t0. adding ( days: - 29 ) ] ,
12791260 ] [ path] !
12801261 }
1262+ $0. fileManager. checkoutsDirectory = { " /checkouts " }
1263+ $0. fileManager. contentsOfDirectory = { @Sendable _ in [ " foo " , " bar " ] }
1264+ } operation: {
1265+ // setup
12811266 let removedPaths = NIOLockedValueBox < [ String ] > ( [ ] )
12821267 Current . fileManager. removeItem = { @Sendable p in removedPaths. withLockedValue { $0. append ( p) } }
12831268
0 commit comments