Show More
@@ -26,7 +26,18 b' from rhodecode.lib.vcs.backends.base imp' | |||||
26 |
|
26 | |||
27 |
|
27 | |||
28 | class TestMercurialRemoteRepoInvalidation(object): |
|
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 | default_ref = Reference('branch', 'default', None) |
|
38 | default_ref = Reference('branch', 'default', None) | |
|
39 | ||||
|
40 | # Methods of vcsserver.hg.HgRemote that are "writing" operations. | |||
30 | writing_methods = [ |
|
41 | writing_methods = [ | |
31 | 'bookmark', |
|
42 | 'bookmark', | |
32 | 'commit', |
|
43 | 'commit', | |
@@ -103,9 +114,18 b' class TestMercurialRemoteRepoInvalidatio' | |||||
103 | return shadow_repo, source_ref, target_ref |
|
114 | return shadow_repo, source_ref, target_ref | |
104 |
|
115 | |||
105 | @pytest.mark.backends('hg') |
|
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 | from rhodecode.lib.vcs.exceptions import CommitDoesNotExistError |
|
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 | pull_request = pr_util.create_pull_request() |
|
129 | pull_request = pr_util.create_pull_request() | |
110 | target_vcs = pull_request.target_repo.scm_instance() |
|
130 | target_vcs = pull_request.target_repo.scm_instance() | |
111 | source_vcs = pull_request.source_repo.scm_instance() |
|
131 | source_vcs = pull_request.source_repo.scm_instance() | |
@@ -135,7 +155,17 b' class TestMercurialRemoteRepoInvalidatio' | |||||
135 | shadow_repo.get_commit(source_ref.commit_id) |
|
155 | shadow_repo.get_commit(source_ref.commit_id) | |
136 |
|
156 | |||
137 | @pytest.mark.backends('hg') |
|
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 | pull_request = pr_util.create_pull_request() |
|
169 | pull_request = pr_util.create_pull_request() | |
140 | target_vcs = pull_request.target_repo.scm_instance() |
|
170 | target_vcs = pull_request.target_repo.scm_instance() | |
141 | source_vcs = pull_request.source_repo.scm_instance() |
|
171 | source_vcs = pull_request.source_repo.scm_instance() |
General Comments 0
You need to be logged in to leave comments.
Login now