Interface IGameHost
- Namespace
- Valheim.Testing.GameSessions
- Assembly
- Valheim.Testing.GameSessions.dll
A machine or container that runs a game server or client for a test run. Every operation takes an explicit deadline. A remote operation that times out or loses its reply reports an unknown outcome, never a pass or a failure, and is never retried here: a mutation must not be repeated blindly.
public interface IGameHost
Properties
Kind
GameHostKind Kind { get; }
Property Value
Name
string Name { get; }
Property Value
- string
Shell
HostShell Shell { get; }
Property Value
Methods
AcquireLockAsync(string, string, TimeSpan, CancellationToken)
Takes the host's exclusive lock for owner (a run id); throws HostLockException if another run holds it or the claim is unproven.
Task<HostLock> AcquireLockAsync(string lockPath, string owner, TimeSpan timeout, CancellationToken cancellation = default)
Parameters
lockPathstringownerstringtimeoutTimeSpancancellationCancellationToken
Returns
- Task<HostLock>
CheckLockAsync(string, string, TimeSpan, CancellationToken)
Task<HostLockResult> CheckLockAsync(string lockPath, string owner, TimeSpan timeout, CancellationToken cancellation = default)
Parameters
lockPathstringownerstringtimeoutTimeSpancancellationCancellationToken
Returns
- Task<HostLockResult>
FetchDirectoryAsync(string, string, TimeSpan, CancellationToken)
Copies a host directory (evidence: logs, reports) into a new local directory.
Task<FetchedDirectory> FetchDirectoryAsync(string hostDirectory, string localDirectory, TimeSpan timeout, CancellationToken cancellation = default)
Parameters
hostDirectorystringlocalDirectorystringtimeoutTimeSpancancellationCancellationToken
Returns
- Task<FetchedDirectory>
LogOffsetAsync(string, TimeSpan, CancellationToken)
The log's current length in bytes (0 if it does not exist), for a later WaitForLogAsync(string, long, Regex, IReadOnlyList<Regex>?, TimeSpan, CancellationToken).
Task<long> LogOffsetAsync(string logPath, TimeSpan timeout, CancellationToken cancellation = default)
Parameters
logPathstringtimeoutTimeSpancancellationCancellationToken
Returns
- Task<long>
OpenCliTunnelAsync(int, TimeSpan, int, CancellationToken)
A local loopback endpoint for the ValheimCLI listening on the host's 127.0.0.1:hostPort.
Task<CliTunnel> OpenCliTunnelAsync(int hostPort, TimeSpan readyTimeout, int localPort = 0, CancellationToken cancellation = default)
Parameters
hostPortintreadyTimeoutTimeSpanlocalPortintcancellationCancellationToken
Returns
- Task<CliTunnel>
ReleaseLockAsync(string, string, TimeSpan, CancellationToken)
Task<HostLockResult> ReleaseLockAsync(string lockPath, string owner, TimeSpan timeout, CancellationToken cancellation = default)
Parameters
lockPathstringownerstringtimeoutTimeSpancancellationCancellationToken
Returns
- Task<HostLockResult>
RunAsync(string, IReadOnlyDictionary<string, string>?, TimeSpan, CancellationToken)
Runs a script with variables that arrive as literals, never parsed by a shell.
Task<HostResult> RunAsync(string script, IReadOnlyDictionary<string, string>? variables, TimeSpan timeout, CancellationToken cancellation = default)
Parameters
scriptstringvariablesIReadOnlyDictionary<string, string>timeoutTimeSpancancellationCancellationToken
Returns
- Task<HostResult>
ShipFilesAsync(string, string, TimeSpan, CancellationToken)
Ships a local directory's files into a new host directory.
Task<Shipment> ShipFilesAsync(string localDirectory, string hostDirectory, TimeSpan timeout, CancellationToken cancellation = default)
Parameters
localDirectorystringhostDirectorystringtimeoutTimeSpancancellationCancellationToken
Returns
- Task<Shipment>
ShipRevisionAsync(string, string, string, TimeSpan, CancellationToken)
Ships one committed git revision (tracked files only) into a new host directory.
Task<Shipment> ShipRevisionAsync(string repository, string revision, string hostDirectory, TimeSpan timeout, CancellationToken cancellation = default)
Parameters
repositorystringrevisionstringhostDirectorystringtimeoutTimeSpancancellationCancellationToken
Returns
- Task<Shipment>
WaitForLogAsync(string, long, Regex, IReadOnlyList<Regex>?, TimeSpan, CancellationToken)
Follows a host log from a byte offset until a line matches success or one of failures, or the deadline.
Task<HostLogResult> WaitForLogAsync(string logPath, long fromOffset, Regex success, IReadOnlyList<Regex>? failures, TimeSpan timeout, CancellationToken cancellation = default)
Parameters
logPathstringfromOffsetlongsuccessRegexfailuresIReadOnlyList<Regex>timeoutTimeSpancancellationCancellationToken
Returns
- Task<HostLogResult>