From 9fcd3ddcd3ceaf1360a0019d7e750995f1ff1bf1 Mon Sep 17 00:00:00 2001 From: "denis.bilenko" Date: Fri, 13 Nov 2026 16:11:15 +0000 Subject: [PATCH] acc: make retry warning order deterministic in sync upload-504 tests Sync progress is written to stdout from the event goroutine, while the retry warning is logged to stderr, so the two can interleave either way. Capture stderr separately and print it after the command finishes. Co-authored-by: Isaac --- acceptance/bundle/sync/upload-504/output.txt | 2 +- acceptance/bundle/sync/upload-504/script | 8 +++++++- acceptance/cmd/sync/upload-504/output.txt | 2 +- acceptance/cmd/sync/upload-504/script | 9 +++++++-- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/acceptance/bundle/sync/upload-504/output.txt b/acceptance/bundle/sync/upload-504/output.txt index d05ed02a23e..055922ed64f 100644 --- a/acceptance/bundle/sync/upload-504/output.txt +++ b/acceptance/bundle/sync/upload-504/output.txt @@ -1,6 +1,6 @@ Action: PUT: databricks.yml -Warn: retrying after 504 Gateway Timeout from POST /api/2.0/workspace-files/import-file/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files/databricks.yml Uploaded databricks.yml Initial Sync Complete +Warn: retrying after 504 Gateway Timeout from POST /api/2.0/workspace-files/import-file/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files/databricks.yml /api/2.0/workspace-files/import-file/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files/databricks.yml /api/2.0/workspace-files/import-file/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files/databricks.yml diff --git a/acceptance/bundle/sync/upload-504/script b/acceptance/bundle/sync/upload-504/script index f3ca9aff682..926fbd62fcd 100644 --- a/acceptance/bundle/sync/upload-504/script +++ b/acceptance/bundle/sync/upload-504/script @@ -1,7 +1,13 @@ # Inject a single 504 on the first file upload. Uploads overwrite, so they are retried and the sync succeeds. fault.py "POST /api/2.0/workspace-files/import-file/**" 504 0 1 -$CLI bundle sync +# Progress goes to stdout from a separate goroutine while the retry warning is logged to stderr, +# so their interleaving is nondeterministic. Print stderr after stdout to keep the order stable. +# The file lives outside the synced directory so that it is not uploaded. +errfile=$(mktemp) +$CLI bundle sync 2> "$errfile" +cat "$errfile" +rm "$errfile" # databricks.yml is the only file. Two requests for it should appear: the initial 504 and the successful retry. print_requests.py //api/2.0/workspace-files/import-file | jq -r .path diff --git a/acceptance/cmd/sync/upload-504/output.txt b/acceptance/cmd/sync/upload-504/output.txt index 669f986c419..79b92f93328 100644 --- a/acceptance/cmd/sync/upload-504/output.txt +++ b/acceptance/cmd/sync/upload-504/output.txt @@ -1,6 +1,6 @@ Action: PUT: hello.py -Warn: retrying after 504 Gateway Timeout from POST /api/2.0/workspace-files/import-file/Users/[USERNAME]/sync-504-[UNIQUE_NAME]/hello.py Uploaded hello.py Initial Sync Complete +Warn: retrying after 504 Gateway Timeout from POST /api/2.0/workspace-files/import-file/Users/[USERNAME]/sync-504-[UNIQUE_NAME]/hello.py /api/2.0/workspace-files/import-file/Users/[USERNAME]/sync-504-[UNIQUE_NAME]/hello.py /api/2.0/workspace-files/import-file/Users/[USERNAME]/sync-504-[UNIQUE_NAME]/hello.py diff --git a/acceptance/cmd/sync/upload-504/script b/acceptance/cmd/sync/upload-504/script index b7000ed9385..3f83dbfa7b5 100644 --- a/acceptance/cmd/sync/upload-504/script +++ b/acceptance/cmd/sync/upload-504/script @@ -10,7 +10,7 @@ remote_dir="/Users/$CURRENT_USER_NAME/sync-504-$UNIQUE_NAME" cleanup() { MSYS_NO_PATHCONV=1 $CLI workspace delete --recursive "$remote_dir" 2>/dev/null || true - rm -rf .git .gitignore .databricks "$OUT_REQUESTS" + rm -rf .git .gitignore .databricks "$OUT_REQUESTS" "$errfile" } trap cleanup EXIT @@ -18,7 +18,12 @@ trap cleanup EXIT fault.py "POST /api/2.0/workspace-files/import-file/**" 504 0 1 # MSYS_NO_PATHCONV=1 prevents Git Bash on Windows from converting /Users/... to C:/Program Files/Git/Users/... -MSYS_NO_PATHCONV=1 $CLI sync . "$remote_dir" +# Progress goes to stdout from a separate goroutine while the retry warning is logged to stderr, +# so their interleaving is nondeterministic. Print stderr after stdout to keep the order stable. +# The file lives outside the synced directory so that it is not uploaded. +errfile=$(mktemp) +MSYS_NO_PATHCONV=1 $CLI sync . "$remote_dir" 2> "$errfile" +cat "$errfile" # Two requests for hello.py should appear: the initial 504 and the successful retry. print_requests.py //api/2.0/workspace-files/import-file | jq -r .path