Commit b69d02b0 authored by Sebastien Robin's avatar Sebastien Robin

after resetting software, retry_software_count was not resetted correctly

parent 4975e31d
......@@ -606,4 +606,41 @@ branch = foo
# then we set keep time to 0, folder will be deleted
test_node.max_temp_time = 0
test_node._cleanupTemporaryFiles()
check(set(['something']))
\ No newline at end of file
check(set(['something']))
def test_18_resetSoftwareAfterManyBuildFailures(self):
"""
Check that after several building failures that the software is resetted
"""
initial_initializeSlapOSControler = \
SlapOSControler.initializeSlapOSControler
initial_runSoftwareRelease = SlapOSControler.runSoftwareRelease
test_node = self.getTestNode()
node_test_suite = test_node.getNodeTestSuite('foo')
init_call_kw_list = []
def initializeSlapOSControler(self, **kw):
init_call_kw_list.append(kw)
def runSoftwareRelease(self, *args, **kw):
return {"status_code": 1}
SlapOSControler.initializeSlapOSControler = initializeSlapOSControler
SlapOSControler.runSoftwareRelease = runSoftwareRelease
def callPrepareSlapOS():
test_node._prepareSlapOS(self.working_directory, node_test_suite,
test_node.log, create_partition=0)
def callRaisingPrepareSlapos():
self.assertRaises(SubprocessError, callPrepareSlapOS)
self.assertEquals(node_test_suite.retry_software_count, 0)
for x in xrange(0,11):
callRaisingPrepareSlapos()
self.assertEquals(len(init_call_kw_list), 11)
self.assertEquals(init_call_kw_list[-1]['reset_software'], False)
self.assertEquals(node_test_suite.retry_software_count, 11)
callRaisingPrepareSlapos()
self.assertEquals(init_call_kw_list[-1]['reset_software'], True)
self.assertEquals(node_test_suite.retry_software_count, 1)
callRaisingPrepareSlapos()
self.assertEquals(init_call_kw_list[-1]['reset_software'], False)
self.assertEquals(node_test_suite.retry_software_count, 2)
SlapOSControler.initializeSlapOSControler = \
initial_initializeSlapOSControler
SlapOSControler.runSoftwareRelease = initial_runSoftwareRelease
......@@ -149,6 +149,7 @@ class TestNode(object):
for y in to_remove_reference_set:
fpath = os.path.join(config['working_directory'],y)
self.delNodeTestSuite(y)
self.log("testnode.checkOldTestSuite, DELETING : %r" % (fpath,))
if os.path.isdir(fpath):
shutil.rmtree(fpath)
else:
......@@ -290,6 +291,8 @@ branch = %(branch)s
'slapproxy.log')
log('Configured slapproxy log to %r' % slapproxy_log)
reset_software = slapos_instance.retry_software_count > 10
if reset_software:
slapos_instance.retry_software_count = 0
log('testnode, retry_software_count : %r' % \
slapos_instance.retry_software_count)
self.slapos_controler = SlapOSControler.SlapOSControler(
......
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