Change 33015

tom_tyler (C. Thomas Tyler)
C. Thomas Tyler committed this change into //guest/tom_tyler/sw/main/install_sdp/dev/bin
Request Review
Download .zip
Test suite robustness: Use journalctl for backup service check.

Tests 157 and its BackupRecoveryMultiInstance equivalent were checking
'sleep 20 && systemctl status opt_perforce_sdp_backup.service' for
the SUCCESS message, which failed intermittently due to two issues:

1. systemctl status shows only the last 10 journal lines by default.
   If the backup script produces more output after the SUCCESS message,
   the message is pushed out of the window.

2. The backup script uses 'exec > >(tee "$Log")' for logging. A race
   condition between bash exiting and the tee subprocess flushing its
   buffer can cause the last few output lines (including the SUCCESS
   summary) to never reach the journal at all. This is the primary
   cause of the transient failure.

Fix: Replace the fragile systemctl status check with:
  journalctl -u opt_perforce_sdp_backup.service --no-pager -n 500

This also removes the unnecessary 'sleep 20': systemctl start blocks
until a Type=oneshot service completes, so the service is already done
before this test runs.

The expected exit code changes from N (NonZero) to 0, since journalctl
exits 0 on success rather than the 3 returned by systemctl status for
an inactive service.

Note: The tee race condition root cause will be addressed separately in
logging.lib for SDP 2026.1 Patch 1 using a targeted wait on the tee PID.
  • Files 1
  • Comments 0
1 edited 0 added 0 deleted
cli_tests.cfg#71
Loading...
Tip: Use n and p to cycle through the changes.