test: add isolated Linux server lifecycle soak launcher
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env bash
|
||||
# Task-owned Linux namespace only. Existing test logic and limits are unchanged.
|
||||
set -euo pipefail
|
||||
mkdir -p /task/tmp /task/data /task/results
|
||||
export TMPDIR=/task/tmp
|
||||
export XDG_DATA_HOME=/task/data
|
||||
export OTOPCUA_SDK2_SOAK=1
|
||||
export OTOPCUA_SDK2_SOAK_OUTPUT=/task/soak.jsonl
|
||||
export DOTNET_CLI_TELEMETRY_OPTOUT=1
|
||||
export DOTNET_NOLOGO=1
|
||||
[[ $(uname -s) == Linux && $(uname -m) == aarch64 ]]
|
||||
[[ -d /proc/self/fd ]]
|
||||
printf 'kernel=%s machine=%s tmp=%s procfs=yes\n' "$(uname -s)" "$(uname -m)" "$(readlink -f "$TMPDIR")" > /task/linux-precheck.txt
|
||||
dotnet --info > /task/container-dotnet-info.txt
|
||||
dotnet vstest /app/ZB.MOM.WW.OtOpcUa.OpcUaServer.IntegrationTests.dll \
|
||||
--TestCaseFilter:'FullyQualifiedName~Sdk2LifecycleSoakTests.Descriptor_probe_' \
|
||||
--ResultsDirectory:/task/results '--Logger:trx;LogFileName=descriptor-controls.trx' > /task/descriptor-controls.log 2>&1
|
||||
# VSTest launches the published xUnit v3 self-contained Linux ELF apphost.
|
||||
# A distinct invocation gives the soak its own otherwise idle test process.
|
||||
dotnet vstest /app/ZB.MOM.WW.OtOpcUa.OpcUaServer.IntegrationTests.dll \
|
||||
--TestCaseFilter:'FullyQualifiedName=ZB.MOM.WW.OtOpcUa.OpcUaServer.IntegrationTests.Sdk2LifecycleSoakTests.Repeated_lifecycles_return_resources_to_a_steady_baseline' \
|
||||
--ResultsDirectory:/task/results '--Logger:trx;LogFileName=soak.trx' > /task/soak.log 2>&1 &
|
||||
vstest_pid=$!
|
||||
observed=0
|
||||
for attempt in $(seq 1 600); do
|
||||
if [[ -s /task/soak.jsonl ]]; then
|
||||
test_pid=$(head -n 1 /task/soak.jsonl | sed -n 's/.*"processId":\([0-9]*\),.*/\1/p')
|
||||
[[ -n "$test_pid" ]]
|
||||
test_exe=$(readlink "/proc/$test_pid/exe")
|
||||
[[ "$test_exe" == /app/ZB.MOM.WW.OtOpcUa.OpcUaServer.IntegrationTests ]]
|
||||
printf 'testProcessId=%s\nactualExecutable=%s\n' "$test_pid" "$test_exe" > /task/linux-runtime-process.txt
|
||||
awk '$6 ~ /\/(libcoreclr.so|libhostfxr.so|libhostpolicy.so|System.Private.CoreLib.dll)$/ {print $6}' "/proc/$test_pid/maps" | sort -u >> /task/linux-runtime-process.txt
|
||||
grep -Fx /app/libcoreclr.so /task/linux-runtime-process.txt > /dev/null
|
||||
observed=1
|
||||
break
|
||||
fi
|
||||
kill -0 "$vstest_pid" 2>/dev/null || break
|
||||
sleep 0.1
|
||||
done
|
||||
[[ "$observed" == 1 ]]
|
||||
wait "$vstest_pid"
|
||||
Reference in New Issue
Block a user