Skip to content

Commit 8226543

Browse files
ryan-williamsclaude
andcommitted
\test_push_end_batches_cache_pushes\: accept both race outcomes
CI on Linux runs both per-stage commits to completion (separate \`git commit\` calls for each .dvc, no \`.git/index.lock\` race); my local macOS run consistently sees one of the two get dropped. Both are valid pre-existing behavior for \`--push end\` (end-of-run cache push uses \`executed\` results, not commits). Assert the committed-subjects set is in \`{ {"Run a"}, {"Run b"}, {"Run a", "Run b"} }\`. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 7415af6 commit 8226543

1 file changed

Lines changed: 12 additions & 11 deletions

File tree

tests/test_run_push_s3.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -272,18 +272,19 @@ def test_push_end_batches_cache_pushes(runner, repo_with_remote):
272272
Stage("b.txt", "running"),
273273
]
274274
# Pre-existing race: per-stage ``git add -u`` + ``git commit`` runs
275-
# from each artifact's thread in parallel; the second one's
276-
# ``git add -u`` races on ``.git/index.lock`` and is silently
277-
# dropped. With ``--push end`` this is harmless — the end-of-run
275+
# from each artifact's thread in parallel. On Linux both commits
276+
# consistently succeed (each picks up its own .dvc, separate
277+
# commits); on macOS the second one's ``git add -u`` sometimes
278+
# races on ``.git/index.lock`` and is silently dropped (1 commit).
279+
# Both outcomes are valid for ``--push end`` since the end-of-run
278280
# cache push uses ``executed`` from all results, not the commits.
279-
# We assert it observably: 1 commit succeeded, with no per-stage
280-
# push or cache push (those are deferred to end).
281-
assert len(run.actions) == 1
282-
committed = run.actions[0]
283-
assert committed.committed in ("Run a", "Run b")
284-
assert committed.pushed is None
285-
assert committed.cache_blobs is None
286-
assert committed.cache_failed is None
281+
committed_subjects = {a.committed for a in run.actions}
282+
assert committed_subjects in ({"Run a"}, {"Run b"}, {"Run a", "Run b"})
283+
for a in run.actions:
284+
# No per-stage push / cache push under ``--push end``.
285+
assert a.pushed is None
286+
assert a.cache_blobs is None
287+
assert a.cache_failed is None
287288
# End-of-run: git push attempted (fails, no remote) + cache push of both blobs.
288289
assert run.end_pushed is False
289290
assert run.end_cache_blobs == 2

0 commit comments

Comments
 (0)