Commit bd2f51c9 authored by Julien Muchembled's avatar Julien Muchembled

fixup! erp5.util.testnode: tell SR to clone in shared mode

If automatic GC happens just after the testnode repository is updated,
the repository in the SR may lose objects and fail to update.

See commit 9634a7d8.
parent 5abc5c2d
......@@ -103,7 +103,7 @@ class Updater(object):
return self._git('update-server-info', '-f')
def git_create_repository_link(self):
""" Create a link in depository to the ".git" directory.
""" Create a link in repository to the ".git" directory.
ex:
for "../erp5/.git"
"../erp5/erp5.git"->"../erp5/.git" will be created.
......@@ -122,7 +122,10 @@ class Updater(object):
except OSError:
logger.error("Cannot create link from %s -> %s",
git_repository_link_path, git_repository_path)
def git_gc_auto(self):
self._git("gc", "--auto")
def _git_find_rev(self, ref):
try:
return self._git_cache[ref]
......@@ -168,9 +171,12 @@ class Updater(object):
if not os.path.exists(self.repository_path):
parameter_list = ['clone', self.url]
if self.branch is not None:
parameter_list.extend(['-b', self.branch])
parameter_list += '-b', self.branch
parameter_list.append(self.repository_path)
self._git(*parameter_list, cwd=self.working_directory)
# Disable automatic GC because we're usually cloned in shared mode.
# We call 'gc auto' explicitly, when it's safe.
self._git("config", "gc.auto" , "0")
def checkout(self, *path_list):
self.checkRepository()
......
......@@ -200,6 +200,7 @@ shared = true
node_test_suite.revision, test_result.revision)
updater_kw = dict(git_binary=self.config['git_binary'],
process_manager=self.process_manager)
updater_list = []
revision_list = []
for i, revision in enumerate(test_result.revision.split(',')):
vcs_repository = node_test_suite.vcs_repository_list[i]
......@@ -213,7 +214,12 @@ shared = true
updater.checkout()
updater.git_update_server_info()
updater.git_create_repository_link()
updater_list.append(updater)
node_test_suite.revision_list = revision_list
def git_gc_auto():
for updater in updater_list:
updater.git_gc_auto()
return git_gc_auto
def _cleanupLog(self):
log_directory = self.config['log_directory']
......@@ -340,7 +346,7 @@ shared = true
with self.suiteLog(node_test_suite) as suite_log_folder_name:
test_result.reportStatus('LOG url', "%s/%s" % (
config.get('httpd_url'), suite_log_folder_name), '')
self.checkRevision(test_result,node_test_suite)
git_gc_auto = self.checkRevision(test_result, node_test_suite)
node_test_suite.edit(test_result=test_result)
# get cluster configuration for this test suite, this is needed to
# know slapos parameters to user for creating instances
......@@ -355,6 +361,10 @@ shared = true
self.constructProfile(node_test_suite, my_test_type,
runner.getRelativePathUsage())
status_dict = runner.prepareSlapOSForTestSuite(node_test_suite)
# SR built successfully. Any cloned repository (with --shared)
# should be at the same revision, so it is safe to prune orphan
# objects now.
git_gc_auto()
# Give some time so computer partitions may start
# as partitions can be of any kind we have and likely will never have
# a reliable way to check if they are up or not ...
......
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