##// END OF EJS Templates
tests: fix cache problems after empty repo check change.
marcink -
r3738:b8214661 new-ui
parent child Browse files
Show More
@@ -44,6 +44,7 b' class TestGetRepo(object):'
44 44 self, apikey_attr, expect_secrets, cache_param, backend,
45 45 user_util):
46 46 repo = backend.create_repo()
47 repo_id = repo.repo_id
47 48 usr = UserModel().get_by_username(TEST_USER_ADMIN_LOGIN)
48 49 group = user_util.create_user_group(members=[usr])
49 50 user_util.grant_user_group_permission_to_repo(
@@ -64,6 +65,8 b' class TestGetRepo(object):'
64 65 permissions = expected_permissions(repo)
65 66
66 67 followers = []
68
69 repo = RepoModel().get(repo_id)
67 70 for user in repo.followers:
68 71 followers.append(user.user.get_api_data(
69 72 include_secrets=expect_secrets))
@@ -84,6 +87,7 b' class TestGetRepo(object):'
84 87 # TODO: Depending on which tests are running before this one, we
85 88 # start with a different number of permissions in the database.
86 89 repo = RepoModel().get_by_repo_name(backend.repo_name)
90 repo_id = repo.repo_id
87 91 permission_count = len(repo.repo_to_perm)
88 92
89 93 RepoModel().grant_user_permission(repo=backend.repo_name,
@@ -102,6 +106,8 b' class TestGetRepo(object):'
102 106 permissions = expected_permissions(repo)
103 107
104 108 followers = []
109
110 repo = RepoModel().get(repo_id)
105 111 for user in repo.followers:
106 112 followers.append(user.user.get_api_data())
107 113
@@ -2465,8 +2465,7 b' class Repository(Base, BaseModel):'
2465 2465 else:
2466 2466 instance = get_instance_cached(*args)
2467 2467
2468 log.debug(
2469 'Repo instance fetched in %.3fs', inv_context_manager.compute_time)
2468 log.debug('Repo instance fetched in %.3fs', inv_context_manager.compute_time)
2470 2469 return instance
2471 2470
2472 2471 def _get_instance(self, cache=True, config=None):
@@ -683,6 +683,8 b' class PullRequestModel(BaseModel):'
683 683
684 684 # source repo
685 685 source_repo = pull_request.source_repo.scm_instance()
686 source_repo.count() # cache rebuild
687
686 688 try:
687 689 source_commit = source_repo.get_commit(commit_id=source_ref_name)
688 690 except CommitDoesNotExistError:
@@ -696,6 +698,8 b' class PullRequestModel(BaseModel):'
696 698
697 699 # target repo
698 700 target_repo = pull_request.target_repo.scm_instance()
701 target_repo.count() # cache rebuild
702
699 703 try:
700 704 target_commit = target_repo.get_commit(commit_id=target_ref_name)
701 705 except CommitDoesNotExistError:
@@ -1337,6 +1341,8 b' class PullRequestModel(BaseModel):'
1337 1341 name_or_id = reference.name
1338 1342 else:
1339 1343 name_or_id = reference.commit_id
1344
1345 vcs_repository.count() # cache rebuild
1340 1346 refreshed_commit = vcs_repository.get_commit(name_or_id)
1341 1347 refreshed_reference = Reference(
1342 1348 reference.type, reference.name, refreshed_commit.raw_id)
@@ -631,7 +631,9 b' class Backend(object):'
631 631 commits = commits or [
632 632 {'message': 'Commit %s of %s' % (x, self.repo_name)}
633 633 for x in range(number_of_commits)]
634 self._add_commits_to_repo(repo.scm_instance(), commits)
634 vcs_repo = repo.scm_instance()
635 vcs_repo.count()
636 self._add_commits_to_repo(vcs_repo, commits)
635 637 if heads:
636 638 self.pull_heads(repo, heads)
637 639
General Comments 0
You need to be logged in to leave comments. Login now