Show More
@@ -26,7 +26,18 b' from rhodecode.lib.vcs.backends.base imp' | |||
|
26 | 26 | |
|
27 | 27 | |
|
28 | 28 | class TestMercurialRemoteRepoInvalidation(object): |
|
29 | """ | |
|
30 | If the VCSServer is running with multiple processes or/and instances. | |
|
31 | Operations on repositories are potentially handled by different processes | |
|
32 | in a random fashion. The mercurial repository objects used in the VCSServer | |
|
33 | are caching the commits of the repo. Therefore we have to invalidate the | |
|
34 | VCSServer caching of these objects after a writing operation. | |
|
35 | """ | |
|
36 | ||
|
37 | # Default reference used as a dummy during tests. | |
|
29 | 38 | default_ref = Reference('branch', 'default', None) |
|
39 | ||
|
40 | # Methods of vcsserver.hg.HgRemote that are "writing" operations. | |
|
30 | 41 | writing_methods = [ |
|
31 | 42 | 'bookmark', |
|
32 | 43 | 'commit', |
@@ -103,9 +114,18 b' class TestMercurialRemoteRepoInvalidatio' | |||
|
103 | 114 | return shadow_repo, source_ref, target_ref |
|
104 | 115 | |
|
105 | 116 | @pytest.mark.backends('hg') |
|
106 | def test_commit_does_not_exist_error_happens(self, pr_util): | |
|
117 | def test_commit_does_not_exist_error_happens(self, pr_util, pylonsapp): | |
|
118 | """ | |
|
119 | This test is somewhat special. It does not really test the system | |
|
120 | instead it is more or less a precondition for the | |
|
121 | "test_commit_does_not_exist_error_does_not_happen". It deactivates the | |
|
122 | cache invalidation and asserts that the error occurs. | |
|
123 | """ | |
|
107 | 124 | from rhodecode.lib.vcs.exceptions import CommitDoesNotExistError |
|
108 | 125 | |
|
126 | if pylonsapp.config['vcs.server.protocol'] != 'http': | |
|
127 | pytest.skip('Test is intended for the HTTP protocol only.') | |
|
128 | ||
|
109 | 129 | pull_request = pr_util.create_pull_request() |
|
110 | 130 | target_vcs = pull_request.target_repo.scm_instance() |
|
111 | 131 | source_vcs = pull_request.source_repo.scm_instance() |
@@ -135,7 +155,17 b' class TestMercurialRemoteRepoInvalidatio' | |||
|
135 | 155 | shadow_repo.get_commit(source_ref.commit_id) |
|
136 | 156 | |
|
137 | 157 | @pytest.mark.backends('hg') |
|
138 |
def test_commit_does_not_exist_error_does_not_happen( |
|
|
158 | def test_commit_does_not_exist_error_does_not_happen( | |
|
159 | self, pr_util, pylonsapp): | |
|
160 | """ | |
|
161 | This test simulates a pull request merge in which the pull operations | |
|
162 | are handled by a different VCSServer process than all other operations. | |
|
163 | Without correct cache invalidation this leads to an error when | |
|
164 | retrieving the pulled commits afterwards. | |
|
165 | """ | |
|
166 | if pylonsapp.config['vcs.server.protocol'] != 'http': | |
|
167 | pytest.skip('Test is intended for the HTTP protocol only.') | |
|
168 | ||
|
139 | 169 | pull_request = pr_util.create_pull_request() |
|
140 | 170 | target_vcs = pull_request.target_repo.scm_instance() |
|
141 | 171 | source_vcs = pull_request.source_repo.scm_instance() |
General Comments 0
You need to be logged in to leave comments.
Login now