fix(signoz): normalize zero active-operation readback

This commit is contained in:
Your Name
2026-07-22 23:04:55 +08:00
parent df50718ac5
commit c43c61578b
2 changed files with 11 additions and 5 deletions

View File

@@ -919,11 +919,13 @@ if /usr/bin/docker exec signoz /bin/sh -c 'test "${SIGNOZ_SQLSTORE_SQLITE_PATH:-
$active = Invoke-Agent99SignozFixedRemote (
"sudo -n /bin/bash -c 'set -euo pipefail; set +e; " +
"active_output=`$(/usr/bin/pgrep -fc `"([s]ignoz-metadata-export.py.*--apply|[s]ignoz-metadata-isolated-restore.py.*--apply|[s]ignoz-metadata-restore-drill.py.*--apply)`" ); " +
"active_output=`$(/usr/bin/timeout --kill-after=5s 10s /usr/bin/pgrep -af `"([s]ignoz-metadata-export.py.*--apply|[s]ignoz-metadata-isolated-restore.py.*--apply|[s]ignoz-metadata-restore-drill.py.*--apply)`" ); " +
"active_rc=`$?; set -e; " +
"[ `"`$active_rc`" -eq 0 ] || [ `"`$active_rc`" -eq 1 ]; " +
"/usr/bin/printf `"%s`" `"`$active_output`" | /usr/bin/grep -Eq `"^[0-9]+$`"; " +
"/usr/bin/printf `"agent99_active:%s`" `"`$active_output`"'"
"case `"`$active_rc`" in " +
"0) active_count=`$(/usr/bin/printf `"%s\n`" `"`$active_output`" | /usr/bin/awk `"NF { count += 1 } END { print count + 0 }`");; " +
"1) [ -z `"`$active_output`" ]; active_count=0;; " +
"*) exit 1;; esac; " +
"/usr/bin/printf `"agent99_active:%s`" `"`$active_count`"'"
)
$activeOperationCount = $null
$activeOutcomeAccepted = Test-Agent99SignozTransportOutcome $active

View File

@@ -245,7 +245,11 @@ def test_entrypoint_typed_readbacks_are_exact_and_preserve_unknown_state() -> No
)
assert '"^agent99_runtime:([0-9a-f]{64}),(sha256:' in preflight
assert '"^agent99_active:([0-9]+)$"' in preflight
assert '[ `"`$active_rc`" -eq 0 ] || [ `"`$active_rc`" -eq 1 ]' in preflight
assert "/usr/bin/timeout --kill-after=5s 10s /usr/bin/pgrep -af" in preflight
assert 'case `"`$active_rc`" in' in preflight
assert '/usr/bin/awk `"NF { count += 1 } END { print count + 0 }`"' in preflight
assert '1) [ -z `"`$active_output`" ]; active_count=0' in preflight
assert 'agent99_active:%s`" `"`$active_count' in preflight
assert "outputPresent = if ($outputStateReadbackVerified)" in preflight
assert "receiptPresent = if ($receiptStateReadbackVerified)" in preflight
assert "credentialReferencePresent = if ($credentialReadbackVerified)" in preflight