Skip to content

Commit

Permalink
Wait for remote cache store request
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladislav Alekseev committed May 11, 2020
1 parent 58a5c19 commit aabbf03
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1577,6 +1577,7 @@ let package = Package(
name: "TestDiscovery",
dependencies: [
"AppleTools",
"AtomicModels",
"BuildArtifacts",
"DeveloperDirLocator",
"Extensions",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import AtomicModels
import BuildArtifacts
import Foundation
import Logging
Expand Down Expand Up @@ -58,12 +59,19 @@ class DefaultRuntimeDumpRemoteCache: RuntimeDumpRemoteCache {
payload: tests
)

let didFinishRequest = AtomicValue(false)

sender.sendRequestWithCallback(
request: request,
credentials: config.credentials,
callbackQueue: callbackQueue
) { (result: Either<VoidPayload, RequestSenderError>) in
Logger.verboseDebug("Stored runtime query with result: \(result)")
didFinishRequest.set(true)
}

try waiter.waitWhile(timeout: 20.0, description: "Runtime Dump Remote Cache Store") { () -> Bool in
didFinishRequest.currentValue() == false
}
}

Expand Down
1 change: 1 addition & 0 deletions Tests/TestDiscoveryTests/RuntimeDumpRemoteCacheTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class RuntimeDumpRemoteCacheTests: XCTestCase {
let expectedPath = "/pathToRemoteStorage/a74c1c98661e4c27fc3e569f40c74feaf4775d1b77c4a82928364728ab6c23b0.json"
let queryResult = TestDiscoveryResultFixtures.queryResult()

requestSender.result = VoidPayload()
try cache.store(
tests: queryResult.discoveredTests,
xcTestBundleLocation: xcTestBundleLocation
Expand Down

0 comments on commit aabbf03

Please sign in to comment.