Skip to content

Commit

Permalink
allow remote xctest connections w/ a flag
Browse files Browse the repository at this point in the history
  • Loading branch information
herval committed Dec 11, 2024
1 parent edef9bf commit 6ede149
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions maestro-ios-driver/src/main/kotlin/util/CommandLineUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ object CommandLineUtils {
private val logger = LoggerFactory.getLogger(CommandLineUtils::class.java)

@Suppress("SpreadOperator")
fun runCommand(parts: List<String>, waitForCompletion: Boolean = true, outputFile: File? = null, params: Map<String, String> = emptyMap()): Process {
fun runCommand(parts: List<String>, waitForCompletion: Boolean = true, outputFile: File? = null, envVars: Map<String, String> = emptyMap()): Process {
logger.info("Running command line operation: $parts")

val processBuilder = if (outputFile != null) {
Expand All @@ -27,7 +27,7 @@ object CommandLineUtils {
.redirectError(nullFile)
}

processBuilder.environment().putAll(params)
processBuilder.environment().putAll(envVars)
val process = processBuilder.start()

if (waitForCompletion) {
Expand Down
3 changes: 1 addition & 2 deletions maestro-ios-driver/src/main/kotlin/util/XCRunnerCLIUtils.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package util

import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import maestro.utils.MaestroTimer
import net.harawata.appdirs.AppDirsFactory
import java.io.File
import java.nio.file.Files
Expand Down Expand Up @@ -142,7 +141,7 @@ object XCRunnerCLIUtils {
),
waitForCompletion = false,
outputFile = outputFile,
params = mapOf("TEST_RUNNER_PORT" to port.toString(), "ACCEPT_REMOTE_CONNECTIONS" to acceptRemoteConnections.toString())
envVars = mapOf("TEST_RUNNER_PORT" to port.toString(), "ACCEPT_REMOTE_CONNECTIONS" to acceptRemoteConnections.toString())
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ struct XCTestHTTPServer {

let acceptRemoteConnections = ProcessInfo.processInfo.environment["ACCEPT_REMOTE_CONNECTIONS"] == "true"

let server = HTTPServer(address: acceptRemoteConnections ? .inet6(port: port) : .loopback(port: port))
let server = HTTPServer(address: acceptRemoteConnections ? .inet6(port: port) : .loopback(port: port), timeout: 100)

for route in Route.allCases {
let handler = await RouteHandlerFactory.createRouteHandler(route: route)
Expand Down

0 comments on commit 6ede149

Please sign in to comment.