Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
138
Merge Requests
138
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
7eca345f
Commit
7eca345f
authored
Apr 29, 2019
by
Sebastien Robin
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testnode: handle cases of corrupted index files when updating git repositories
parent
5db52eee
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
1 deletion
+38
-1
erp5/tests/testERP5TestNode.py
erp5/tests/testERP5TestNode.py
+32
-0
erp5/util/testnode/testnode.py
erp5/util/testnode/testnode.py
+6
-1
No files found.
erp5/tests/testERP5TestNode.py
View file @
7eca345f
...
...
@@ -437,6 +437,38 @@ shared = true
rev_list
=
self
.
getAndUpdateFullRevisionList
(
test_node
,
node_test_suite
)
self
.
assertEqual
(
None
,
rev_list
)
def
test_05f_ResetCorruptedRepository
(
self
):
"""
It could happens that repository are corrupted, like when server is restarted
in the middle of a git checkout. So make sure testnode remove repositories
that are not working any longer.
Usual error is "index file smaller than expected".
We reproduce here a similar error "bad index file sha1 signature" which we
know how to reproduce
"""
commit_dict
=
self
.
generateTestRepositoryList
()
test_node
=
self
.
getTestNode
()
node_test_suite
=
test_node
.
getNodeTestSuite
(
'foo'
)
self
.
updateNodeTestSuiteData
(
node_test_suite
)
rev_list
=
self
.
getAndUpdateFullRevisionList
(
test_node
,
node_test_suite
)
self
.
assertTrue
(
rev_list
is
not
None
)
rep0_clone_path
=
[
x
[
'repository_path'
]
for
x
in
\
node_test_suite
.
vcs_repository_list
\
if
x
[
'repository_path'
].
endswith
(
"rep0"
)][
0
]
# truncate index file to reproduce error
index_file
=
open
(
os
.
path
.
join
(
rep0_clone_path
,
'.git'
,
'index'
),
'a'
)
index_file
.
seek
(
1
,
2
)
index_file
.
truncate
()
index_file
.
close
()
# we get rev list with corrupted repository, we get None, but in the same
# time the bad repository is deleted
rev_list
=
self
.
getAndUpdateFullRevisionList
(
test_node
,
node_test_suite
)
self
.
assertEqual
(
None
,
rev_list
)
# So next update should go fine
rev_list
=
self
.
getAndUpdateFullRevisionList
(
test_node
,
node_test_suite
)
self
.
assertTrue
(
rev_list
is
not
None
)
def
test_06_checkRevision
(
self
):
"""
Check if we are able to restore older commit hash if master decide so
...
...
erp5/util/testnode/testnode.py
View file @
7eca345f
...
...
@@ -167,7 +167,12 @@ shared = true
url
=
vcs_repository
[
"url"
])
updater
.
checkout
()
revision_list
.
append
((
repository_id
,
updater
.
getRevision
()))
except
SubprocessError
:
except
SubprocessError
as
error
:
# only limit to particular error, if we run that code for all errors,
# then if server having most repositories is down for some time, we would
# erase all repositories and facing later hours of downloads
if
getattr
(
error
,
'stderr'
,
''
).
find
(
'index file'
)
>=
0
:
rmtree
(
repository_path
)
logger
.
warning
(
"Error while getting repository, ignoring this test suite"
,
exc_info
=
1
)
return
False
...
...
Jérome Perrin
@jerome
mentioned in merge request
!863 (merged)
·
May 13, 2019
mentioned in merge request
!863 (merged)
mentioned in merge request !863
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment