Commit d28d8f2d authored by Jérome Perrin's avatar Jérome Perrin

testnode: update corrupted index test for git 2.17.0

The way of truncating the index file was an error in git 2.11.0, but it
was not an error with git 2.17.0.

/reviewed-on !863
parent 82538098
...@@ -443,9 +443,9 @@ shared = true ...@@ -443,9 +443,9 @@ shared = true
in the middle of a git checkout. So make sure testnode remove repositories in the middle of a git checkout. So make sure testnode remove repositories
that are not working any longer. that are not working any longer.
Usual error is "index file smaller than expected". In this test, we cause an artificial corruption by truncating git
We reproduce here a similar error "bad index file sha1 signature" which we repository's index, then we call updateRevisionList to check that it can
know how to reproduce recover from this corruption.
""" """
commit_dict = self.generateTestRepositoryList() commit_dict = self.generateTestRepositoryList()
test_node = self.getTestNode() test_node = self.getTestNode()
...@@ -456,9 +456,9 @@ shared = true ...@@ -456,9 +456,9 @@ shared = true
rep0_clone_path = [x['repository_path'] for x in \ rep0_clone_path = [x['repository_path'] for x in \
node_test_suite.vcs_repository_list \ node_test_suite.vcs_repository_list \
if x['repository_path'].endswith("rep0")][0] if x['repository_path'].endswith("rep0")][0]
# truncate index file to reproduce error # simulate a data corruption on rep0's index
index_file = open(os.path.join(rep0_clone_path, '.git', 'index'), 'a') index_file = open(os.path.join(rep0_clone_path, '.git', 'index'), 'a')
index_file.seek(1,2) index_file.seek(10, os.SEEK_END)
index_file.truncate() index_file.truncate()
index_file.close() index_file.close()
# we get rev list with corrupted repository, we get None, but in the same # we get rev list with corrupted repository, we get None, but in the same
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment