fix(gates): support a second account for remote shadows
This commit is contained in:
parent
a861510a37
commit
a7b18364cd
2 changed files with 29 additions and 9 deletions
|
|
@ -3,6 +3,8 @@ param(
|
|||
[string]$Repository = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path,
|
||||
[string]$Account = $env:ACDREAM_TEST_USER,
|
||||
[string]$Password = $env:ACDREAM_TEST_PASS,
|
||||
[string]$ObserverAccount,
|
||||
[string]$ObserverPassword,
|
||||
[ValidateRange(0, [int]::MaxValue)][int]$PrimaryCharacterIndex = 0,
|
||||
[ValidateRange(0, [int]::MaxValue)][int]$ObserverCharacterIndex = 1,
|
||||
[switch]$SkipBuild,
|
||||
|
|
@ -15,6 +17,8 @@ $ErrorActionPreference = 'Stop'
|
|||
|
||||
if ([string]::IsNullOrWhiteSpace($Account)) { $Account = 'testaccount' }
|
||||
if ([string]::IsNullOrWhiteSpace($Password)) { $Password = 'testpassword' }
|
||||
if ([string]::IsNullOrWhiteSpace($ObserverAccount)) { $ObserverAccount = $Account }
|
||||
if ([string]::IsNullOrWhiteSpace($ObserverPassword)) { $ObserverPassword = $Password }
|
||||
if ($PrimaryCharacterIndex -eq $ObserverCharacterIndex) {
|
||||
throw 'Primary and observer character indexes must differ.'
|
||||
}
|
||||
|
|
@ -45,7 +49,9 @@ function Set-ClientEnvironment {
|
|||
param(
|
||||
[Parameter(Mandatory = $true)][object]$State,
|
||||
[Parameter(Mandatory = $true)][string]$ArtifactDirectory,
|
||||
[Parameter(Mandatory = $true)][string]$Route
|
||||
[Parameter(Mandatory = $true)][string]$Route,
|
||||
[Parameter(Mandatory = $true)][string]$SessionAccount,
|
||||
[Parameter(Mandatory = $true)][string]$SessionPassword
|
||||
)
|
||||
$env:ACDREAM_CONFIG_DIR = $State.ConfigDirectory
|
||||
$env:ACDREAM_DATA_DIR = $State.DataDirectory
|
||||
|
|
@ -54,8 +60,8 @@ function Set-ClientEnvironment {
|
|||
$env:ACDREAM_LIVE = '1'
|
||||
$env:ACDREAM_TEST_HOST = '127.0.0.1'
|
||||
$env:ACDREAM_TEST_PORT = '9000'
|
||||
$env:ACDREAM_TEST_USER = $Account
|
||||
$env:ACDREAM_TEST_PASS = $Password
|
||||
$env:ACDREAM_TEST_USER = $SessionAccount
|
||||
$env:ACDREAM_TEST_PASS = $SessionPassword
|
||||
$env:ACDREAM_RETAIL_UI = '1'
|
||||
$env:ACDREAM_DEVTOOLS = '0'
|
||||
$env:ACDREAM_UI_PROBE_DUMP = '0'
|
||||
|
|
@ -77,9 +83,15 @@ function Wait-ForLogPattern {
|
|||
if ($Client.HasExited) {
|
||||
throw "client exited with code $($Client.ExitCode) while waiting for '$Pattern'"
|
||||
}
|
||||
if ((Test-Path -LiteralPath $Path) -and
|
||||
(Select-String -LiteralPath $Path -SimpleMatch $Pattern -Quiet)) {
|
||||
return
|
||||
if (Test-Path -LiteralPath $Path) {
|
||||
$sessionFailure = Select-String -LiteralPath $Path `
|
||||
-SimpleMatch 'live: session failed:' | Select-Object -Last 1
|
||||
if ($null -ne $sessionFailure) {
|
||||
throw "client session failed while waiting for '$Pattern': $($sessionFailure.Line)"
|
||||
}
|
||||
if (Select-String -LiteralPath $Path -SimpleMatch $Pattern -Quiet) {
|
||||
return
|
||||
}
|
||||
}
|
||||
Start-Sleep -Milliseconds 250
|
||||
}
|
||||
|
|
@ -210,7 +222,7 @@ try {
|
|||
$observerStatus = Join-Path $observerState.StateDirectory 'status\observer.jsonl'
|
||||
$primaryStatus = Join-Path $primaryState.StateDirectory 'status\primary.jsonl'
|
||||
$observerConfig = New-ConnectedGraphicalSessionConfig `
|
||||
-State $observerState -Account $Account `
|
||||
-State $observerState -Account $ObserverAccount `
|
||||
-CharacterIndex $ObserverCharacterIndex -Plugins @() `
|
||||
-StatusFile $observerStatus
|
||||
$primaryConfig = New-ConnectedGraphicalSessionConfig `
|
||||
|
|
@ -220,7 +232,8 @@ try {
|
|||
|
||||
$observerStdout = Join-Path $observerRoot 'client.stdout.log'
|
||||
$observerStderr = Join-Path $observerRoot 'client.stderr.log'
|
||||
Set-ClientEnvironment $observerState $observerRoot $observerRoute
|
||||
Set-ClientEnvironment $observerState $observerRoot $observerRoute `
|
||||
$ObserverAccount $ObserverPassword
|
||||
$observer = Start-Process -FilePath $exe -WorkingDirectory $Repository `
|
||||
-ArgumentList @('--session-config', ('"' + $observerConfig + '"')) `
|
||||
-RedirectStandardOutput $observerStdout `
|
||||
|
|
@ -230,7 +243,8 @@ try {
|
|||
|
||||
$primaryStdout = Join-Path $primaryRoot 'client.stdout.log'
|
||||
$primaryStderr = Join-Path $primaryRoot 'client.stderr.log'
|
||||
Set-ClientEnvironment $primaryState $primaryRoot $primaryRoute
|
||||
Set-ClientEnvironment $primaryState $primaryRoot $primaryRoute `
|
||||
$Account $Password
|
||||
$primary = Start-Process -FilePath $exe -WorkingDirectory $Repository `
|
||||
-ArgumentList @('--session-config', ('"' + $primaryConfig + '"')) `
|
||||
-RedirectStandardOutput $primaryStdout `
|
||||
|
|
@ -299,6 +313,8 @@ finally {
|
|||
TrackedSourceStatus = if ($null -eq $binaryIdentity) { @() } else { @($binaryIdentity.SourceTrackedStatus) }
|
||||
PrimaryCharacterIndex = $PrimaryCharacterIndex
|
||||
ObserverCharacterIndex = $ObserverCharacterIndex
|
||||
DistinctAccountsConfigured = -not [string]::Equals(
|
||||
$Account, $ObserverAccount, [StringComparison]::OrdinalIgnoreCase)
|
||||
Result = $result
|
||||
Failure = $failure
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue