fleetd #552: warn instead of aborting when the post-restart mktemp fails #560
Reference in New Issue
Block a user
Delete Branch "worker/552-post-restart-mktemp-abort-bc2672-4"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #552.
By the time the fresh-log
mktempran, the daemon had already been stopped, the jar swapped, and the new daemon started. An unguardedmktempfailure there still aborted the whole script, so a caller read the resulting non-zero exit as "the redeploy failed" and the likely next action was to restart an already-correctly-restarted daemon.Fix
mktempinto a newcapture_fresh_log_region(), guarded the same wayunload_launchd_if_loaded/stop_systemd_if_loadedguard their own (if ! ... ; then), butwarninstead ofdie— there is nothing left to protect by refusing after a successful restart.FRESH_LOG=""is declared and thetrapinstalled before the call that may fail to fill it in, not after.classify_amqp_connection_errorsandreport_shutdown_draineach gain a new state for an uncapturable log region (REDEPLOY_AMQP_CHECK_SKIPPED,REDEPLOY_DRAIN_STATE=skipped), distinct from "captured a region with nothing in it" — each says so in its own output.Tests added (scripts/test-redeploy-fleetd.sh)
test_capture_fresh_log_region_control/test_capture_fresh_log_region_mktemp_failure_returns_nonzero_and_prints_nothing— the extracted function itself, stubbingmktempon PATH (same technique PR #548 added).test_fresh_log_capture_failure_does_not_abort_under_sete— drives the real guarded call-site shape underset -euo pipefailwithmktempstubbed to fail, proving the script does not abort.test_no_unguarded_mktemp_assignments_after_restart— source-text shape check: no bareVAR="..."after the restart call, so the next one added is caught too.test_capture_fresh_log_region_call_site_is_guarded— pins the real call site is guarded, since it no longer contains the literal text "mktemp" for the shape check above to see.test_classify_amqp_connection_errors_reports_skipped_when_log_missing,test_report_shutdown_drain_skipped_when_log_missing,test_report_shutdown_drain_na_wins_over_missing_log,test_result_section_checks_amqp_skip_before_no_error_lines— the third-state handling in each of the four readers.Every new test was mutation-proofed by hand: pristine anchor counted, mutated with line-anchored
sed, confirmed red with the test's own failure message, restored, confirmed byte-identical hash, confirmed green.Build/test run
bash scripts/test-redeploy-fleetd.sh— exit 0, endsPASS: redeploy log classifier. No Java files touched, somvnwas not run; CI's separateshell-testsjob covers this suite.Out of scope (noted, not investigated): #555 (the main-flow seam and the eight untested decisions), same file, sequenced after this.