coleheflin commented on code in PR #69735:
URL: https://github.com/apache/airflow/pull/69735#discussion_r3753616146
##########
providers/git/tests/unit/git/bundles/test_git.py:
##########
@@ -701,6 +701,46 @@ def test_refresh_tag_moved_forward_and_backward(self,
mock_githook, git_repo):
files_in_repo = {f.name for f in bundle.path.iterdir() if f.is_file()}
assert {"test_dag.py"} == files_in_repo
+ @mock.patch("airflow.providers.git.bundles.git.GitHook")
+ def test_tracking_ref_commit_sha_promote_and_rollback(self, mock_githook,
git_repo):
+ """Ensure tracking_ref accepts a full commit SHA, and a SHA-pinned
bundle can be
+ promoted to a new SHA and rolled back.
+
+ Promotion/rollback is simulated by creating a new bundle object with
the updated
+ tracking_ref, mirroring how a bundle config change is applied in
practice.
+ """
+ repo_path, repo = git_repo
+ mock_githook.return_value.repo_url = repo_path
+ first_commit = repo.head.commit
+
+ file_path = repo_path / "new_test.py"
+ with open(file_path, "w") as f:
+ f.write("hello world")
+ repo.index.add([file_path])
+ second_commit = repo.index.commit("Another commit")
Review Comment:
Good catch, moved the new-commit creation so it happens after the first
`initialize()`. Split the old test into three: a rollback case (still green —
objects are already local), a promote-without-clearing-storage case that now
asserts the actual `GitCommandError` this raises today (documents the
limitation tracked in #71388, with a note to flip it to asserting success once
that's fixed), and a promote-with-fresh-storage case (different bundle name →
fresh local storage) that asserts promotion succeeds once storage doesn't carry
the stale clone. All tests in the file still pass (105, after rebasing onto
current `main`).
---
Drafted-by: Claude Code (Sonnet 5); reviewed by @coleheflin before posting
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]