FakeSsh

class FakeSsh(remoteFiles: Map<String, String> = emptyMap(), remoteEnv: Map<String, String> = emptyMap(), remoteCommands: Map<List<String>, CommandResult> = emptyMap(), uname: String = "Linux x86_64", sshResult: CommandResult? = null, canRun: Boolean = true, val os: String = "macos", val capabilities: Set<Capability> = Capability.entries.toSet(), machines: Map<String, FakeSsh> = emptyMap()) : Host(source)

A local host that answers ssh from a scripted remote, for tests that need a base host for SshHost. sshResult, when set, answers every ssh call (a connection failure, for example); machines answers the calls to a destination with another scripted remote.

Constructors

Link copied to clipboard
constructor(remoteFiles: Map<String, String> = emptyMap(), remoteEnv: Map<String, String> = emptyMap(), remoteCommands: Map<List<String>, CommandResult> = emptyMap(), uname: String = "Linux x86_64", sshResult: CommandResult? = null, canRun: Boolean = true, os: String = "macos", capabilities: Set<Capability> = Capability.entries.toSet(), machines: Map<String, FakeSsh> = emptyMap())

Properties

Link copied to clipboard
open override val arch: String
Link copied to clipboard
open override val capabilities: Set<Capability>
Link copied to clipboard
open override val os: String
Link copied to clipboard
open override val platform: String
Link copied to clipboard

Every local command, ssh included.

Link copied to clipboard

The words of every remote command, as the remote shell would split them.

Functions

Link copied to clipboard

Null off Linux, without cgroup v2, or when none of the four counters can be read.

Link copied to clipboard
open override fun env(): Map<String, String>
Link copied to clipboard
open fun facts(): List<Attribute>
Link copied to clipboard
open override fun readText(path: String): String?
Link copied to clipboard
open override fun run(argv: List<String>): CommandResult?

open fun run(argv: List<String>, timeoutMillis: Long? = null, onOutput: (String) -> Unit): CommandResult?

Like run, but hands the merged output to onOutput while the process runs. The result carries the exit code and an empty output; the callback has seen all of it. Past timeoutMillis the child is killed and the result carries TIMED_OUT_EXIT_CODE. A host that can measure the child fills CommandResult.usage.

Link copied to clipboard
open fun syncNanos(dir: String, rounds: Int): List<Long>?

Nanoseconds per write-and-fsync of a 4 KiB file in dir, or null when the host cannot.