diff options
| author | Joanna Wang <jojwang@google.com> | 2022-12-02 09:47:29 -0500 |
|---|---|---|
| committer | Joanna Wang <jojwang@google.com> | 2022-12-02 14:57:56 +0000 |
| commit | ea5239ddd930624532cd1d0edccc0f3e74bec73f (patch) | |
| tree | e0883d5a6e8986ee712c4440c5ed238e00ba652f /tests/test_project.py | |
| parent | 1b8714937c20d43f98bd9ffe498a49fcfb086141 (diff) | |
| download | git-repo-ea5239ddd930624532cd1d0edccc0f3e74bec73f.tar.gz | |
Fix ManifestProject.partial_clone_exclude property.
Bug: b/256358360
Change-Id: Ic6e3a049aa38827123d0324c8b14157562c5986e
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/353574
Reviewed-by: Mike Frysinger <vapier@google.com>
Tested-by: Joanna Wang <jojwang@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Diffstat (limited to 'tests/test_project.py')
| -rw-r--r-- | tests/test_project.py | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/tests/test_project.py b/tests/test_project.py index 47018d1c..7d07b705 100644 --- a/tests/test_project.py +++ b/tests/test_project.py | |||
| @@ -22,6 +22,7 @@ import tempfile | |||
| 22 | import unittest | 22 | import unittest |
| 23 | 23 | ||
| 24 | import error | 24 | import error |
| 25 | import manifest_xml | ||
| 25 | import git_command | 26 | import git_command |
| 26 | import git_config | 27 | import git_config |
| 27 | import platform_utils | 28 | import platform_utils |
| @@ -411,3 +412,81 @@ class MigrateWorkTreeTests(unittest.TestCase): | |||
| 411 | self.assertTrue((dotgit / name).is_file()) | 412 | self.assertTrue((dotgit / name).is_file()) |
| 412 | for name in self._SYMLINKS: | 413 | for name in self._SYMLINKS: |
| 413 | self.assertTrue((dotgit / name).is_symlink()) | 414 | self.assertTrue((dotgit / name).is_symlink()) |
| 415 | |||
| 416 | |||
| 417 | class ManifestPropertiesFetchedCorrectly(unittest.TestCase): | ||
| 418 | """Ensure properties are fetched properly.""" | ||
| 419 | |||
| 420 | def setUpManifest(self, tempdir): | ||
| 421 | repo_trace._TRACE_FILE = os.path.join(tempdir, 'TRACE_FILE_from_test') | ||
| 422 | |||
| 423 | repodir = os.path.join(tempdir, '.repo') | ||
| 424 | manifest_dir = os.path.join(repodir, 'manifests') | ||
| 425 | manifest_file = os.path.join( | ||
| 426 | repodir, manifest_xml.MANIFEST_FILE_NAME) | ||
| 427 | local_manifest_dir = os.path.join( | ||
| 428 | repodir, manifest_xml.LOCAL_MANIFESTS_DIR_NAME) | ||
| 429 | os.mkdir(repodir) | ||
| 430 | os.mkdir(manifest_dir) | ||
| 431 | manifest = manifest_xml.XmlManifest(repodir, manifest_file) | ||
| 432 | |||
| 433 | return project.ManifestProject( | ||
| 434 | manifest, 'test/manifest', os.path.join(tempdir, '.git'), tempdir) | ||
| 435 | |||
| 436 | def test_manifest_config_properties(self): | ||
| 437 | """Test we are fetching the manifest config properties correctly.""" | ||
| 438 | |||
| 439 | with TempGitTree() as tempdir: | ||
| 440 | fakeproj = self.setUpManifest(tempdir) | ||
| 441 | |||
| 442 | # Set property using the expected Set method, then ensure | ||
| 443 | # the porperty functions are using the correct Get methods. | ||
| 444 | fakeproj.config.SetString( | ||
| 445 | 'manifest.standalone', 'https://chicken/manifest.git') | ||
| 446 | self.assertEqual( | ||
| 447 | fakeproj.standalone_manifest_url, 'https://chicken/manifest.git') | ||
| 448 | |||
| 449 | fakeproj.config.SetString('manifest.groups', 'test-group, admin-group') | ||
| 450 | self.assertEqual(fakeproj.manifest_groups, 'test-group, admin-group') | ||
| 451 | |||
| 452 | fakeproj.config.SetString('repo.reference', 'mirror/ref') | ||
| 453 | self.assertEqual(fakeproj.reference, 'mirror/ref') | ||
| 454 | |||
| 455 | fakeproj.config.SetBoolean('repo.dissociate', False) | ||
| 456 | self.assertFalse(fakeproj.dissociate) | ||
| 457 | |||
| 458 | fakeproj.config.SetBoolean('repo.archive', False) | ||
| 459 | self.assertFalse(fakeproj.archive) | ||
| 460 | |||
| 461 | fakeproj.config.SetBoolean('repo.mirror', False) | ||
| 462 | self.assertFalse(fakeproj.mirror) | ||
| 463 | |||
| 464 | fakeproj.config.SetBoolean('repo.worktree', False) | ||
| 465 | self.assertFalse(fakeproj.use_worktree) | ||
| 466 | |||
| 467 | fakeproj.config.SetBoolean('repo.clonebundle', False) | ||
| 468 | self.assertFalse(fakeproj.clone_bundle) | ||
| 469 | |||
| 470 | fakeproj.config.SetBoolean('repo.submodules', False) | ||
| 471 | self.assertFalse(fakeproj.submodules) | ||
| 472 | |||
| 473 | fakeproj.config.SetBoolean('repo.git-lfs', False) | ||
| 474 | self.assertFalse(fakeproj.git_lfs) | ||
| 475 | |||
| 476 | fakeproj.config.SetBoolean('repo.superproject', False) | ||
| 477 | self.assertFalse(fakeproj.use_superproject) | ||
| 478 | |||
| 479 | fakeproj.config.SetBoolean('repo.partialclone', False) | ||
| 480 | self.assertFalse(fakeproj.partial_clone) | ||
| 481 | |||
| 482 | fakeproj.config.SetString('repo.depth', '48') | ||
| 483 | self.assertEquals(fakeproj.depth, '48') | ||
| 484 | |||
| 485 | fakeproj.config.SetString('repo.clonefilter', 'blob:limit=10M') | ||
| 486 | self.assertEquals(fakeproj.clone_filter, 'blob:limit=10M') | ||
| 487 | |||
| 488 | fakeproj.config.SetString('repo.partialcloneexclude', 'third_party/big_repo') | ||
| 489 | self.assertEquals(fakeproj.partial_clone_exclude, 'third_party/big_repo') | ||
| 490 | |||
| 491 | fakeproj.config.SetString('manifest.platform', 'auto') | ||
| 492 | self.assertEquals(fakeproj.manifest_platform, 'auto') | ||
