diff options
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/bundle.lua | 3 | ||||
| -rw-r--r-- | scripts/test.lua | 3 | ||||
| -rwxr-xr-x | scripts/test_linux/crashpad-test.sh | 1 | ||||
| -rwxr-xr-x | scripts/test_linux/service-test.sh | 32 | ||||
| -rwxr-xr-x | scripts/test_mac/service-test.sh | 32 | ||||
| -rw-r--r-- | scripts/test_scripts/builds-download-upload-test.py | 2 | ||||
| -rw-r--r-- | scripts/test_scripts/builds-download-upload-update-build-ids.py | 2 | ||||
| -rw-r--r-- | scripts/test_scripts/hub_load_test.py | 1 | ||||
| -rw-r--r-- | scripts/test_scripts/hub_provision_perf_test.py | 1 | ||||
| -rw-r--r-- | scripts/test_scripts/kill-test-processes.ps1 | 19 | ||||
| -rwxr-xr-x | scripts/test_scripts/kill-test-processes.sh | 45 | ||||
| -rw-r--r-- | scripts/test_scripts/oplog-import-export-test.py | 2 | ||||
| -rw-r--r-- | scripts/test_scripts/oplog-update-build-ids.py | 2 | ||||
| -rw-r--r-- | scripts/test_windows/service-test.ps1 | 32 |
14 files changed, 127 insertions, 50 deletions
diff --git a/scripts/bundle.lua b/scripts/bundle.lua index 3937d8a76..1d94451e7 100644 --- a/scripts/bundle.lua +++ b/scripts/bundle.lua @@ -34,6 +34,9 @@ local function _build(arch, debug, config_args) "--mode="..variant, "--arch="..arch, "--zensentry=yes", + "--zencompute=no", + "--zenhorde=no", + "--zennomad=no", toolchain_arg, sdk_arg, config_args) diff --git a/scripts/test.lua b/scripts/test.lua index 52495342a..d66ccd0f0 100644 --- a/scripts/test.lua +++ b/scripts/test.lua @@ -10,6 +10,7 @@ function main() -- Override table: target name -> short name (for targets that don't follow convention) local short_name_overrides = { ["zenserver-test"] = "integration", + ["zen-test"] = "zen", } -- Build test list from targets in the "tests" group @@ -231,7 +232,7 @@ function main() if use_noskip then cmd = string.format("%s --no-skip", cmd) end - if name == "integration" then + if name == "integration" or name == "zen" then cmd = string.format("%s --kill-stale-processes", cmd) if use_verbose then diff --git a/scripts/test_linux/crashpad-test.sh b/scripts/test_linux/crashpad-test.sh index bd08cefc5..fb9282178 100755 --- a/scripts/test_linux/crashpad-test.sh +++ b/scripts/test_linux/crashpad-test.sh @@ -86,6 +86,7 @@ echo "" # zenserver runs in the foreground until SIGINT/SIGTERM. Launch in background # so we can poll its health endpoint and inspect child processes. "$ZENSERVER_BINARY" \ + --enable-execution-history=false \ --port="$PORT" \ --data-dir="$DATA_DIR" \ > "$STDOUT_FILE" 2>&1 & diff --git a/scripts/test_linux/service-test.sh b/scripts/test_linux/service-test.sh index f91339e1b..7c573b036 100755 --- a/scripts/test_linux/service-test.sh +++ b/scripts/test_linux/service-test.sh @@ -20,6 +20,8 @@ SERVICE_NAME="ZenServerTest-$$" UNIT_NAME="com.epicgames.unreal.${SERVICE_NAME}" UNIT_FILE="/etc/systemd/system/${UNIT_NAME}.service" +zen_cmd() { "$ZEN_BINARY" --enable-execution-history=false "$@"; } + PASSED=0 FAILED=0 TESTS_RUN=0 @@ -122,7 +124,7 @@ SERVICE_USER="${SUDO_USER:-$(whoami)}" echo "--- Test: status before install ---" -OUTPUT=$("$ZEN_BINARY" service status "$SERVICE_NAME" 2>&1 || true) +OUTPUT=$(zen_cmd service status "$SERVICE_NAME" 2>&1 || true) if echo "$OUTPUT" | grep -qi "not installed"; then pass "status reports 'not installed' for non-existent service" else @@ -133,7 +135,7 @@ fi echo "--- Test: install ---" -OUTPUT=$("$ZEN_BINARY" service install "$ZENSERVER_BINARY" "$SERVICE_NAME" --user "$SERVICE_USER" 2>&1) +OUTPUT=$(zen_cmd service install "$ZENSERVER_BINARY" "$SERVICE_NAME" --user "$SERVICE_USER" 2>&1) EXIT_CODE=$? if [ "$EXIT_CODE" -eq 0 ]; then @@ -186,7 +188,7 @@ fi echo "--- Test: install again (idempotent) ---" -OUTPUT=$("$ZEN_BINARY" service install "$ZENSERVER_BINARY" "$SERVICE_NAME" --user "$SERVICE_USER" 2>&1) +OUTPUT=$(zen_cmd service install "$ZENSERVER_BINARY" "$SERVICE_NAME" --user "$SERVICE_USER" 2>&1) EXIT_CODE=$? if [ "$EXIT_CODE" -eq 0 ]; then @@ -205,7 +207,7 @@ fi echo "--- Test: status after install (stopped) ---" -OUTPUT=$("$ZEN_BINARY" service status "$SERVICE_NAME" 2>&1 || true) +OUTPUT=$(zen_cmd service status "$SERVICE_NAME" 2>&1 || true) # The status command throws if not running, so we expect an error message if echo "$OUTPUT" | grep -qi "not running"; then pass "status reports 'not running' for stopped service" @@ -217,7 +219,7 @@ fi echo "--- Test: start ---" -OUTPUT=$("$ZEN_BINARY" service start "$SERVICE_NAME" 2>&1) +OUTPUT=$(zen_cmd service start "$SERVICE_NAME" 2>&1) EXIT_CODE=$? if [ "$EXIT_CODE" -eq 0 ]; then @@ -237,7 +239,7 @@ if systemctl is-active --quiet "$UNIT_NAME" 2>/dev/null; then echo "--- Test: status (running) ---" - OUTPUT=$("$ZEN_BINARY" service status "$SERVICE_NAME" 2>&1 || true) + OUTPUT=$(zen_cmd service status "$SERVICE_NAME" 2>&1 || true) if echo "$OUTPUT" | grep -qi "Running"; then pass "status reports 'Running'" else @@ -254,7 +256,7 @@ if systemctl is-active --quiet "$UNIT_NAME" 2>/dev/null; then echo "--- Test: start again (already running) ---" - OUTPUT=$("$ZEN_BINARY" service start "$SERVICE_NAME" 2>&1) + OUTPUT=$(zen_cmd service start "$SERVICE_NAME" 2>&1) if echo "$OUTPUT" | grep -qi "already running"; then pass "start reports service already running" else @@ -265,7 +267,7 @@ if systemctl is-active --quiet "$UNIT_NAME" 2>/dev/null; then echo "--- Test: stop ---" - OUTPUT=$("$ZEN_BINARY" service stop "$SERVICE_NAME" 2>&1) + OUTPUT=$(zen_cmd service stop "$SERVICE_NAME" 2>&1) EXIT_CODE=$? if [ "$EXIT_CODE" -eq 0 ]; then @@ -293,7 +295,7 @@ echo "--- Test: stop when already stopped ---" systemctl stop "$UNIT_NAME" 2>/dev/null || true sleep 1 -OUTPUT=$("$ZEN_BINARY" service stop "$SERVICE_NAME" 2>&1 || true) +OUTPUT=$(zen_cmd service stop "$SERVICE_NAME" 2>&1 || true) if echo "$OUTPUT" | grep -qi "not running"; then pass "stop reports 'not running' when already stopped" else @@ -305,11 +307,11 @@ fi echo "--- Test: uninstall while running (should fail) ---" # Start the service so we can test uninstall-while-running -"$ZEN_BINARY" service start "$SERVICE_NAME" 2>&1 || true +zen_cmd service start "$SERVICE_NAME" 2>&1 || true sleep 1 if systemctl is-active --quiet "$UNIT_NAME" 2>/dev/null; then - OUTPUT=$("$ZEN_BINARY" service uninstall "$SERVICE_NAME" 2>&1 || true) + OUTPUT=$(zen_cmd service uninstall "$SERVICE_NAME" 2>&1 || true) EXIT_CODE=$? if [ "$EXIT_CODE" -ne 0 ] || echo "$OUTPUT" | grep -qi "running.*stop"; then @@ -319,7 +321,7 @@ if systemctl is-active --quiet "$UNIT_NAME" 2>/dev/null; then fi # Stop it for the real uninstall test - "$ZEN_BINARY" service stop "$SERVICE_NAME" 2>&1 || true + zen_cmd service stop "$SERVICE_NAME" 2>&1 || true systemctl stop "$UNIT_NAME" 2>/dev/null || true sleep 1 else @@ -334,7 +336,7 @@ echo "--- Test: uninstall ---" systemctl stop "$UNIT_NAME" 2>/dev/null || true sleep 1 -OUTPUT=$("$ZEN_BINARY" service uninstall "$SERVICE_NAME" 2>&1) +OUTPUT=$(zen_cmd service uninstall "$SERVICE_NAME" 2>&1) EXIT_CODE=$? if [ "$EXIT_CODE" -eq 0 ]; then @@ -353,7 +355,7 @@ fi echo "--- Test: status after uninstall ---" -OUTPUT=$("$ZEN_BINARY" service status "$SERVICE_NAME" 2>&1 || true) +OUTPUT=$(zen_cmd service status "$SERVICE_NAME" 2>&1 || true) if echo "$OUTPUT" | grep -qi "not installed"; then pass "status reports 'not installed' after uninstall" else @@ -364,7 +366,7 @@ fi echo "--- Test: uninstall when not installed ---" -OUTPUT=$("$ZEN_BINARY" service uninstall "$SERVICE_NAME" 2>&1) +OUTPUT=$(zen_cmd service uninstall "$SERVICE_NAME" 2>&1) EXIT_CODE=$? if [ "$EXIT_CODE" -eq 0 ]; then diff --git a/scripts/test_mac/service-test.sh b/scripts/test_mac/service-test.sh index da4a966e7..8360e60fa 100755 --- a/scripts/test_mac/service-test.sh +++ b/scripts/test_mac/service-test.sh @@ -22,6 +22,8 @@ SERVICE_NAME="ZenServerTest-$$" DAEMON_NAME="com.epicgames.unreal.${SERVICE_NAME}" PLIST_FILE="$HOME/Library/LaunchAgents/${DAEMON_NAME}.plist" +zen_cmd() { "$ZEN_BINARY" --enable-execution-history=false "$@"; } + PASSED=0 FAILED=0 TESTS_RUN=0 @@ -119,7 +121,7 @@ echo "" echo "--- Test: status before install ---" -OUTPUT=$("$ZEN_BINARY" service status "$SERVICE_NAME" 2>&1 || true) +OUTPUT=$(zen_cmd service status "$SERVICE_NAME" 2>&1 || true) if echo "$OUTPUT" | grep -qi "not installed"; then pass "status reports 'not installed' for non-existent service" else @@ -130,7 +132,7 @@ fi echo "--- Test: install ---" -OUTPUT=$("$ZEN_BINARY" service install "$ZENSERVER_BINARY" "$SERVICE_NAME" 2>&1) +OUTPUT=$(zen_cmd service install "$ZENSERVER_BINARY" "$SERVICE_NAME" 2>&1) EXIT_CODE=$? if [ "$EXIT_CODE" -eq 0 ]; then @@ -176,7 +178,7 @@ fi echo "--- Test: install again (idempotent) ---" -OUTPUT=$("$ZEN_BINARY" service install "$ZENSERVER_BINARY" "$SERVICE_NAME" 2>&1) +OUTPUT=$(zen_cmd service install "$ZENSERVER_BINARY" "$SERVICE_NAME" 2>&1) EXIT_CODE=$? if [ "$EXIT_CODE" -eq 0 ]; then @@ -195,7 +197,7 @@ fi echo "--- Test: status after install (stopped) ---" -OUTPUT=$("$ZEN_BINARY" service status "$SERVICE_NAME" 2>&1 || true) +OUTPUT=$(zen_cmd service status "$SERVICE_NAME" 2>&1 || true) if echo "$OUTPUT" | grep -qi "not running"; then pass "status reports 'not running' for stopped service" else @@ -206,7 +208,7 @@ fi echo "--- Test: start ---" -OUTPUT=$("$ZEN_BINARY" service start "$SERVICE_NAME" 2>&1) +OUTPUT=$(zen_cmd service start "$SERVICE_NAME" 2>&1) EXIT_CODE=$? if [ "$EXIT_CODE" -eq 0 ]; then @@ -225,7 +227,7 @@ if launchctl list "$DAEMON_NAME" &>/dev/null; then echo "--- Test: status (running) ---" - OUTPUT=$("$ZEN_BINARY" service status "$SERVICE_NAME" 2>&1 || true) + OUTPUT=$(zen_cmd service status "$SERVICE_NAME" 2>&1 || true) if echo "$OUTPUT" | grep -qi "Running"; then pass "status reports 'Running'" else @@ -242,7 +244,7 @@ if launchctl list "$DAEMON_NAME" &>/dev/null; then echo "--- Test: start again (already running) ---" - OUTPUT=$("$ZEN_BINARY" service start "$SERVICE_NAME" 2>&1) + OUTPUT=$(zen_cmd service start "$SERVICE_NAME" 2>&1) if echo "$OUTPUT" | grep -qi "already running"; then pass "start reports service already running" else @@ -253,7 +255,7 @@ if launchctl list "$DAEMON_NAME" &>/dev/null; then echo "--- Test: stop ---" - OUTPUT=$("$ZEN_BINARY" service stop "$SERVICE_NAME" 2>&1) + OUTPUT=$(zen_cmd service stop "$SERVICE_NAME" 2>&1) EXIT_CODE=$? if [ "$EXIT_CODE" -eq 0 ]; then @@ -281,7 +283,7 @@ echo "--- Test: stop when already stopped ---" launchctl bootout "gui/$(id -u)" "$PLIST_FILE" 2>/dev/null || true sleep 1 -OUTPUT=$("$ZEN_BINARY" service stop "$SERVICE_NAME" 2>&1 || true) +OUTPUT=$(zen_cmd service stop "$SERVICE_NAME" 2>&1 || true) if echo "$OUTPUT" | grep -qi "not running"; then pass "stop reports 'not running' when already stopped" else @@ -293,11 +295,11 @@ fi echo "--- Test: uninstall while running (should fail) ---" # Start the service so we can test uninstall-while-running -"$ZEN_BINARY" service start "$SERVICE_NAME" 2>&1 || true +zen_cmd service start "$SERVICE_NAME" 2>&1 || true sleep 2 if launchctl list "$DAEMON_NAME" &>/dev/null; then - OUTPUT=$("$ZEN_BINARY" service uninstall "$SERVICE_NAME" 2>&1 || true) + OUTPUT=$(zen_cmd service uninstall "$SERVICE_NAME" 2>&1 || true) EXIT_CODE=$? if [ "$EXIT_CODE" -ne 0 ] || echo "$OUTPUT" | grep -qi "running.*stop"; then @@ -307,7 +309,7 @@ if launchctl list "$DAEMON_NAME" &>/dev/null; then fi # Stop it for the real uninstall test - "$ZEN_BINARY" service stop "$SERVICE_NAME" 2>&1 || true + zen_cmd service stop "$SERVICE_NAME" 2>&1 || true launchctl bootout "gui/$(id -u)" "$PLIST_FILE" 2>/dev/null || true sleep 1 else @@ -322,7 +324,7 @@ echo "--- Test: uninstall ---" launchctl bootout "gui/$(id -u)" "$PLIST_FILE" 2>/dev/null || true sleep 1 -OUTPUT=$("$ZEN_BINARY" service uninstall "$SERVICE_NAME" 2>&1) +OUTPUT=$(zen_cmd service uninstall "$SERVICE_NAME" 2>&1) EXIT_CODE=$? if [ "$EXIT_CODE" -eq 0 ]; then @@ -341,7 +343,7 @@ fi echo "--- Test: status after uninstall ---" -OUTPUT=$("$ZEN_BINARY" service status "$SERVICE_NAME" 2>&1 || true) +OUTPUT=$(zen_cmd service status "$SERVICE_NAME" 2>&1 || true) if echo "$OUTPUT" | grep -qi "not installed"; then pass "status reports 'not installed' after uninstall" else @@ -352,7 +354,7 @@ fi echo "--- Test: uninstall when not installed ---" -OUTPUT=$("$ZEN_BINARY" service uninstall "$SERVICE_NAME" 2>&1) +OUTPUT=$(zen_cmd service uninstall "$SERVICE_NAME" 2>&1) EXIT_CODE=$? if [ "$EXIT_CODE" -eq 0 ]; then diff --git a/scripts/test_scripts/builds-download-upload-test.py b/scripts/test_scripts/builds-download-upload-test.py index 8ff5245c1..dd9aae07e 100644 --- a/scripts/test_scripts/builds-download-upload-test.py +++ b/scripts/test_scripts/builds-download-upload-test.py @@ -82,7 +82,7 @@ SERVER_ARGS: tuple[str, ...] = ( def zen_cmd(*args: str | Path, extra_zen_args: list[str] | None = None) -> list[str | Path]: """Build a zen CLI command list, inserting extra_zen_args before subcommands.""" - return [ZEN_EXE, *(extra_zen_args or []), *args] + return [ZEN_EXE, "--enable-execution-history=false", *(extra_zen_args or []), *args] def run(cmd: list[str | Path]) -> None: diff --git a/scripts/test_scripts/builds-download-upload-update-build-ids.py b/scripts/test_scripts/builds-download-upload-update-build-ids.py index 2a63aa44d..6332d6990 100644 --- a/scripts/test_scripts/builds-download-upload-update-build-ids.py +++ b/scripts/test_scripts/builds-download-upload-update-build-ids.py @@ -51,7 +51,7 @@ def list_builds_for_bucket(zen: str, host: str, namespace: str, bucket: str) -> result_path = Path(tmp.name) cmd = [ - zen, "builds", "list", + zen, "--enable-execution-history=false", "builds", "list", "--namespace", namespace, "--bucket", bucket, "--host", host, diff --git a/scripts/test_scripts/hub_load_test.py b/scripts/test_scripts/hub_load_test.py index 7bff1eb37..33f05d90f 100644 --- a/scripts/test_scripts/hub_load_test.py +++ b/scripts/test_scripts/hub_load_test.py @@ -183,6 +183,7 @@ def _start_hub( cmd = [ str(zenserver_exe), "hub", + "--enable-execution-history=false", f"--data-dir={data_dir}", f"--port={port}", "--hub-instance-http-threads=8", diff --git a/scripts/test_scripts/hub_provision_perf_test.py b/scripts/test_scripts/hub_provision_perf_test.py index 5b264ad62..76fb8508d 100644 --- a/scripts/test_scripts/hub_provision_perf_test.py +++ b/scripts/test_scripts/hub_provision_perf_test.py @@ -205,6 +205,7 @@ def _start_hub( cmd = [ str(zenserver_exe), "hub", + "--enable-execution-history=false", f"--data-dir={data_dir}", f"--port={port}", "--hub-instance-http-threads=8", diff --git a/scripts/test_scripts/kill-test-processes.ps1 b/scripts/test_scripts/kill-test-processes.ps1 new file mode 100644 index 000000000..0668a5319 --- /dev/null +++ b/scripts/test_scripts/kill-test-processes.ps1 @@ -0,0 +1,19 @@ +# Kill leftover CI test processes (zenserver, minio, nomad, consul) whose +# executable lives under the given build directory. Windows counterpart of +# kill-test-processes.sh; see that file for rationale. +# +# Usage: kill-test-processes.ps1 -Label <label> -BuildDir <path> + +param( + [Parameter(Mandatory=$true)][string]$Label, + [Parameter(Mandatory=$true)][string]$BuildDir +) + +foreach ($name in @('zenserver', 'minio', 'nomad', 'consul')) { + $procs = Get-Process -Name $name -ErrorAction SilentlyContinue | + Where-Object { $_.Path -and $_.Path.StartsWith($BuildDir, [System.StringComparison]::OrdinalIgnoreCase) } + foreach ($p in $procs) { + Write-Host "Killing $Label $name (PID $($p.Id)): $($p.Path)" + $p | Stop-Process -Force -ErrorAction SilentlyContinue + } +} diff --git a/scripts/test_scripts/kill-test-processes.sh b/scripts/test_scripts/kill-test-processes.sh new file mode 100755 index 000000000..e5fb2fcaa --- /dev/null +++ b/scripts/test_scripts/kill-test-processes.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env bash +# +# Kill leftover CI test processes (zenserver, minio, nomad, consul) whose +# executable lives under the given build directory. +# +# Used by CI workflows to clean up any test processes from a previous run +# before starting a new one, and to reap any that are still running after +# the run finishes. +# +# Usage: kill-test-processes.sh <label> <build_dir> +# label: word printed in log messages, e.g. "stale" or "leftover" +# build_dir: absolute path; only processes whose executable is under this +# directory are killed. +# +# We resolve each PID's actual executable path rather than relying on argv +# (which `pgrep -a` reports). argv starts with the short process name (e.g. +# "consul") regardless of how the process was launched, so a pure argv prefix +# match never fires and leftovers silently survived between runs. + +set -u + +label=${1:?label required} +build_dir=${2:?build_dir required} + +get_exe_path() { + local pid=$1 + if [[ -r "/proc/$pid/exe" ]]; then + # Linux + readlink -f "/proc/$pid/exe" 2>/dev/null || true + else + # macOS fallback: the "txt" file descriptor points at the process binary + lsof -p "$pid" -Fn -a -d txt 2>/dev/null | awk '/^n/{print substr($0,2); exit}' || true + fi +} + +for name in zenserver minio nomad consul; do + while read -r pid; do + [[ -z "$pid" ]] && continue + exe=$(get_exe_path "$pid") + if [[ "$exe" == "$build_dir"* ]]; then + echo "Killing $label $name (PID $pid): $exe" + kill -9 "$pid" 2>/dev/null || true + fi + done < <(pgrep -x "$name" 2>/dev/null || true) +done diff --git a/scripts/test_scripts/oplog-import-export-test.py b/scripts/test_scripts/oplog-import-export-test.py index f913a7351..93f732135 100644 --- a/scripts/test_scripts/oplog-import-export-test.py +++ b/scripts/test_scripts/oplog-import-export-test.py @@ -82,7 +82,7 @@ SERVER_ARGS: tuple[str, ...] = ( def zen_cmd(*args: str | Path, extra_zen_args: list[str] | None = None) -> list[str | Path]: """Build a zen CLI command list, inserting extra_zen_args before subcommands.""" - return [ZEN_EXE, *(extra_zen_args or []), *args] + return [ZEN_EXE, "--enable-execution-history=false", *(extra_zen_args or []), *args] def run(cmd: list[str | Path]) -> None: diff --git a/scripts/test_scripts/oplog-update-build-ids.py b/scripts/test_scripts/oplog-update-build-ids.py index 67e128c8e..2675d07c0 100644 --- a/scripts/test_scripts/oplog-update-build-ids.py +++ b/scripts/test_scripts/oplog-update-build-ids.py @@ -52,7 +52,7 @@ def list_builds_for_bucket(zen: str, host: str, namespace: str, bucket: str) -> result_path = Path(tmp.name) cmd = [ - zen, "builds", "list", + zen, "--enable-execution-history=false", "builds", "list", "--namespace", namespace, "--bucket", bucket, "--host", host, diff --git a/scripts/test_windows/service-test.ps1 b/scripts/test_windows/service-test.ps1 index 4c484c63f..a2723681e 100644 --- a/scripts/test_windows/service-test.ps1 +++ b/scripts/test_windows/service-test.ps1 @@ -22,6 +22,8 @@ if (-not $ZenBinary) { $ZenBinary = Join-Path $RepoRoot "build\windows\x64\debug\zen.exe" } $ZenServerBinary = Join-Path (Split-Path -Parent $ZenBinary) "zenserver.exe" + +function Zen { & $ZenBinary --enable-execution-history=false @args } $ServiceName = "ZenServerTest-$PID" $Script:Passed = 0 @@ -106,7 +108,7 @@ try { Write-Host "--- Test: status before install ---" -$Output = & $ZenBinary service status $ServiceName 2>&1 | Out-String +$Output = Zen service status $ServiceName 2>&1 | Out-String if ($Output -match "not installed") { Pass "status reports 'not installed' for non-existent service" } else { @@ -117,7 +119,7 @@ if ($Output -match "not installed") { Write-Host "--- Test: install ---" -$Output = & $ZenBinary service install $ZenServerBinary $ServiceName --allow-elevation 2>&1 | Out-String +$Output = Zen service install $ZenServerBinary $ServiceName --allow-elevation 2>&1 | Out-String $ExitCode = $LASTEXITCODE if ($ExitCode -eq 0) { @@ -153,7 +155,7 @@ if ($svc) { Write-Host "--- Test: install again (idempotent) ---" -$Output = & $ZenBinary service install $ZenServerBinary $ServiceName --allow-elevation 2>&1 | Out-String +$Output = Zen service install $ZenServerBinary $ServiceName --allow-elevation 2>&1 | Out-String $ExitCode = $LASTEXITCODE if ($ExitCode -eq 0) { @@ -172,7 +174,7 @@ if ($Output -match "already installed") { Write-Host "--- Test: status after install (stopped) ---" -$Output = & $ZenBinary service status $ServiceName 2>&1 | Out-String +$Output = Zen service status $ServiceName 2>&1 | Out-String if ($Output -match "not running") { Pass "status reports 'not running' for stopped service" } else { @@ -183,7 +185,7 @@ if ($Output -match "not running") { Write-Host "--- Test: start ---" -$Output = & $ZenBinary service start $ServiceName --allow-elevation 2>&1 | Out-String +$Output = Zen service start $ServiceName --allow-elevation 2>&1 | Out-String $ExitCode = $LASTEXITCODE if ($ExitCode -eq 0) { @@ -202,7 +204,7 @@ if ($svc -and $svc.Status -eq "Running") { Write-Host "--- Test: status (running) ---" - $Output = & $ZenBinary service status $ServiceName 2>&1 | Out-String + $Output = Zen service status $ServiceName 2>&1 | Out-String if ($Output -match "Running") { Pass "status reports 'Running'" } else { @@ -219,7 +221,7 @@ if ($svc -and $svc.Status -eq "Running") { Write-Host "--- Test: start again (already running) ---" - $Output = & $ZenBinary service start $ServiceName --allow-elevation 2>&1 | Out-String + $Output = Zen service start $ServiceName --allow-elevation 2>&1 | Out-String if ($Output -match "already running") { Pass "start reports service already running" } else { @@ -230,7 +232,7 @@ if ($svc -and $svc.Status -eq "Running") { Write-Host "--- Test: stop ---" - $Output = & $ZenBinary service stop $ServiceName --allow-elevation 2>&1 | Out-String + $Output = Zen service stop $ServiceName --allow-elevation 2>&1 | Out-String $ExitCode = $LASTEXITCODE if ($ExitCode -eq 0) { @@ -258,7 +260,7 @@ Write-Host "--- Test: stop when already stopped ---" Stop-Service -Name $ServiceName -Force -ErrorAction SilentlyContinue Start-Sleep -Seconds 1 -$Output = & $ZenBinary service stop $ServiceName --allow-elevation 2>&1 | Out-String +$Output = Zen service stop $ServiceName --allow-elevation 2>&1 | Out-String if ($Output -match "not running") { Pass "stop reports 'not running' when already stopped" } else { @@ -269,12 +271,12 @@ if ($Output -match "not running") { Write-Host "--- Test: uninstall while running (should fail) ---" -& $ZenBinary service start $ServiceName --allow-elevation 2>&1 | Out-Null +Zen service start $ServiceName --allow-elevation 2>&1 | Out-Null Start-Sleep -Seconds 2 $svc = Get-Service -Name $ServiceName -ErrorAction SilentlyContinue if ($svc -and $svc.Status -eq "Running") { - $Output = & $ZenBinary service uninstall $ServiceName --allow-elevation 2>&1 | Out-String + $Output = Zen service uninstall $ServiceName --allow-elevation 2>&1 | Out-String $ExitCode = $LASTEXITCODE if ($ExitCode -ne 0 -or $Output -match "running.*stop") { @@ -284,7 +286,7 @@ if ($svc -and $svc.Status -eq "Running") { } # Stop it for the real uninstall test - & $ZenBinary service stop $ServiceName --allow-elevation 2>&1 | Out-Null + Zen service stop $ServiceName --allow-elevation 2>&1 | Out-Null Stop-Service -Name $ServiceName -Force -ErrorAction SilentlyContinue Start-Sleep -Seconds 2 } else { @@ -298,7 +300,7 @@ Write-Host "--- Test: uninstall ---" Stop-Service -Name $ServiceName -Force -ErrorAction SilentlyContinue Start-Sleep -Seconds 1 -$Output = & $ZenBinary service uninstall $ServiceName --allow-elevation 2>&1 | Out-String +$Output = Zen service uninstall $ServiceName --allow-elevation 2>&1 | Out-String $ExitCode = $LASTEXITCODE if ($ExitCode -eq 0) { @@ -318,7 +320,7 @@ if (-not $svc) { Write-Host "--- Test: status after uninstall ---" -$Output = & $ZenBinary service status $ServiceName 2>&1 | Out-String +$Output = Zen service status $ServiceName 2>&1 | Out-String if ($Output -match "not installed") { Pass "status reports 'not installed' after uninstall" } else { @@ -329,7 +331,7 @@ if ($Output -match "not installed") { Write-Host "--- Test: uninstall when not installed ---" -$Output = & $ZenBinary service uninstall $ServiceName --allow-elevation 2>&1 | Out-String +$Output = Zen service uninstall $ServiceName --allow-elevation 2>&1 | Out-String $ExitCode = $LASTEXITCODE if ($ExitCode -eq 0) { |