summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGavin Mak <gavinmak@google.com>2026-05-11 19:19:14 +0000
committergerrit-scoped@luci-project-accounts.iam.gserviceaccount.com <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com>2026-05-11 19:36:59 -0700
commita6bc1b7cf0b4c71f9448eb57a2d478049d356c65 (patch)
tree4ccac49b9d5a5834274c761a6cfc23e7801e8e22 /tests
parenta98e4221139765f4475d7c0a524b59c688077e75 (diff)
downloadgit-repo-a6bc1b7cf0b4c71f9448eb57a2d478049d356c65.tar.gz
sync: Exclude stateless sync pruned projects from bloat check
If a project has been pruned for stateless sync, it has already undergone aggressive garbage collection. There should be no bloat to check for. Change-Id: I9233a4611e05b7a0b7c097827d6f408144f7380d Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/581841 Tested-by: Gavin Mak <gavinmak@google.com> Reviewed-by: Becky Siegel <beckysiegel@google.com> Commit-Queue: Gavin Mak <gavinmak@google.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/test_subcmds_sync.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/test_subcmds_sync.py b/tests/test_subcmds_sync.py
index b3726d2d1..0a46bbdf3 100644
--- a/tests/test_subcmds_sync.py
+++ b/tests/test_subcmds_sync.py
@@ -489,6 +489,7 @@ class CheckForBloatedProjects(unittest.TestCase):
489 self.project.name = "project" 489 self.project.name = "project"
490 self.project.Exists = True 490 self.project.Exists = True
491 self.project.worktree = "worktree" 491 self.project.worktree = "worktree"
492 self.project.stateless_prune_needed = False
492 self.cmd.git_event_log = mock.MagicMock() 493 self.cmd.git_event_log = mock.MagicMock()
493 self.cmd._bloated_projects = [] 494 self.cmd._bloated_projects = []
494 495
@@ -530,6 +531,21 @@ class CheckForBloatedProjects(unittest.TestCase):
530 531
531 self.assertEqual(self.cmd._bloated_projects, ["project"]) 532 self.assertEqual(self.cmd._bloated_projects, ["project"])
532 533
534 @mock.patch("subcmds.sync.git_require")
535 @mock.patch("subcmds.sync.Progress")
536 def test_stateless_prune_excluded(self, mock_progress, mock_git_require):
537 """Test that projects pruned for stateless sync are excluded."""
538 mock_git_require.return_value = True
539 self.project.stateless_prune_needed = True
540
541 self.cmd.ExecuteInParallel = mock.Mock()
542
543 with mock.patch.object(self.cmd, "ParallelContext"):
544 self.cmd._CheckForBloatedProjects([self.project], self.opt)
545
546 self.assertFalse(self.cmd.ExecuteInParallel.called)
547 self.assertEqual(self.cmd._bloated_projects, [])
548
533 549
534class GCProjectsTest(unittest.TestCase): 550class GCProjectsTest(unittest.TestCase):
535 """Tests for Sync._GCProjects.""" 551 """Tests for Sync._GCProjects."""