Commit 041b2b2d authored by Robert Schmidt's avatar Robert Schmidt

Remove prematureExit/exitStatus, and implement in task main loop

Use the previous commit on returning success from each task execution
function, and implement handling of errors in the main loop. Add a
script with which this is visible using Custom_Commands.
parent 7b895488
......@@ -84,7 +84,6 @@ def CreateWorkspace(sshSession, sourcePath, ranRepository, ranCommitID, ranTarge
if sshSession.getBefore().count(f'HEAD is now at {ranCommitID[:6]}') != 1:
sshSession.command('git log --oneline | head -n5', '\$', 5)
logging.error(f'problems during checkout, is at: {sshSession.getBefore()}')
self.exitStatus = 1
return False
else:
logging.debug('successful checkout')
......@@ -319,7 +318,6 @@ class Containerize():
self.yamlPath = ['', '', '']
self.services = ['', '', '']
self.nb_healthy = [0, 0, 0]
self.exitStatus = 0
self.eNB_logFile = ['', '', '']
self.testCase_id = ''
......@@ -991,7 +989,6 @@ class Containerize():
deployStatus,allServices = DeployServices(mySSH,self.services[self.eNB_instance])
if deployStatus != 0:
mySSH.close()
self.exitStatus = 1
logging.error('Could not deploy')
HTML.CreateHtmlTestRow('Could not deploy', 'KO', CONST.ALL_PROCESSES_OK)
return False
......@@ -1014,7 +1011,6 @@ class Containerize():
imagesInfo += ("Healthy deployment!")
HTML.CreateHtmlTestRowQueue('N/A', 'OK', [(imagesInfo)])
else:
self.exitStatus = 1
imagesInfo += ("Unhealthy deployment! -- Check logs for reason!")
HTML.CreateHtmlTestRowQueue('N/A', 'KO', [(imagesInfo)])
return status
......@@ -1035,14 +1031,16 @@ class Containerize():
if not copyin_res:
HTML.htmleNBFailureMsg='Could not copy logfile(s) to analyze it!'
HTML.CreateHtmlTestRow('N/A', 'KO', CONST.ENB_PROCESS_NOLOGFILE_TO_ANALYZE)
self.exitStatus = 1
return False
else:
log_results = [CheckLogs(self, mySSH, self.yamlPath[0].split('/'), service_name, HTML, RAN) for service_name, _ in services]
self.exitStatus = 1 if any(log_results) else 0
logging.info('\u001B[1m Undeploying OAI Object Pass\u001B[0m') if self.exitStatus == 0 else logging.error('\u001B[1m Undeploying OAI Object Failed\u001B[0m')
success = any(log_results)
mySSH.close()
return self.exitStatus == 0
if success:
logging.info('\u001B[1m Undeploying OAI Object Pass\u001B[0m')
else:
logging.error('\u001B[1m Undeploying OAI Object Failed\u001B[0m')
return success
def CheckAndAddRoute(self, svrName, ipAddr, userName, password):
logging.debug('Checking IP routing on ' + svrName)
......
......@@ -446,6 +446,8 @@ class HTMLManagement():
self.htmlFile.write(f' <td bgcolor = "lightgreen" >{status}</td>\n')
elif (str(status) == 'KO'):
self.htmlFile.write(f' <td bgcolor = "lightcoral" >{status}</td>\n')
elif str(status) == 'SKIP':
self.htmlFile.write(f' <td bgcolor = "lightgray" >{status}</td>\n')
else:
addOrangeBK = True
self.htmlFile.write(f' <td bgcolor = "orange" >{status}</td>\n')
......
......@@ -900,7 +900,6 @@ class OaiCiTest():
CONTAINERS.UndeployObject(HTML,RAN)
else:
CONTAINERS.UndeployGenObject(HTML,RAN, self)
RAN.prematureExit=True
#this function is called only if eNB/gNB fails to start
#RH to be re-factored
......@@ -930,7 +929,6 @@ class OaiCiTest():
CONTAINERS.UndeployObject(HTML,RAN)
else:
CONTAINERS.UndeployGenObject(HTML,RAN,self)
RAN.prematureExit=True
def LogCollectBuild(self,RAN):
# Some pipelines are using "none" IP / Credentials
......
......@@ -52,7 +52,6 @@ class PhySim:
self.ranCommitID= ""
self.ranAllowMerge= ""
self.ranTargetBranch= ""
self.exitStatus=0
self.forced_workspace_cleanup=False
#private attributes
self.__workSpacePath=''
......@@ -111,7 +110,6 @@ class PhySim:
if res_enc is None and res_dec is None:
logging.error(f'no statistics: res_enc {res_enc} res_dec {res_dec}')
HTML.CreateHtmlTestRowQueue(self.runargs, 'KO', ['no statistics'])
self.exitStatus = 1
os.system(f'mv {self.__runLogFile} {self.__runLogPath}/.')
return False
......@@ -124,7 +122,6 @@ class PhySim:
error_msg = f'Processing time exceeds a limit of {thrs_KO} us'
logging.error(error_msg)
HTML.CreateHtmlTestRowQueue(self.runargs, 'KO', [info + '\n' + error_msg])
self.exitStatus = 1
return success
def __CheckResults_NRulsimTest(self, HTML, CONST, testcase_id):
......@@ -136,7 +133,6 @@ class PhySim:
error_msg = f'could not recover test result file {filename}'
logging.error(error_msg)
HTML.CreateHtmlTestRowQueue("could not recover results", 'KO', [error_msg])
self.exitStatus = 1
return False
PUSCH_OK = False
......@@ -153,7 +149,6 @@ class PhySim:
error_msg = 'error: no "PUSCH test OK"'
logging.error(error_msg)
HTML.CreateHtmlTestRowQueue(self.runargs, 'KO', 1, [error_msg])
self.exitStatus = 1
return PUSCH_OK
def __CheckBuild_PhySim(self, HTML, CONST):
......@@ -169,13 +164,10 @@ class PhySim:
with open(self.__buildLogFile) as f:
if 'BUILD SHOULD BE SUCCESSFUL' in f.read():
HTML.CreateHtmlTestRow(self.buildargs, 'OK', CONST.ALL_PROCESSES_OK, 'PhySim')
self.exitStatus=0
return True
logging.error('\u001B[1m Building Physical Simulators Failed\u001B[0m')
HTML.CreateHtmlTestRow(self.buildargs, 'KO', CONST.ALL_PROCESSES_OK, 'LDPC')
HTML.CreateHtmlTabFooter(False)
#exitStatus=1 will do a sys.exit in main
self.exitStatus = 1
return False
......
......@@ -65,7 +65,7 @@ class PhySim:
#PUBLIC Methods$
#-----------------$
def Deploy_PhySim(self, HTML, RAN):
def Deploy_PhySim(self, HTML):
if self.ranRepository == '' or self.ranBranch == '' or self.ranCommitID == '':
HELP.GenericHelp(CONST.Version)
sys.exit('Insufficient Parameter')
......@@ -123,7 +123,6 @@ class PhySim:
logging.error('\u001B[1m OC Cluster Login Failed\u001B[0m')
mySSH.close()
HTML.CreateHtmlTestRow('N/A', 'KO', CONST.OC_LOGIN_FAIL)
RAN.prematureExit = True
return False
else:
logging.debug('\u001B[1m Login to OC Cluster Successfully\u001B[0m')
......@@ -133,7 +132,6 @@ class PhySim:
mySSH.command('oc logout', '\$', 30)
mySSH.close()
HTML.CreateHtmlTestRow('N/A', 'KO', CONST.OC_PROJECT_FAIL)
RAN.prematureExit = True
return False
else:
logging.debug(f'\u001B[1m Now using project {ocProjectName}\u001B[0m')
......@@ -154,7 +152,6 @@ class PhySim:
mySSH.command('oc logout', '\$', 30)
mySSH.close()
self.AnalyzeLogFile_phySim()
RAN.prematureExit = True
return False
else:
logging.debug('\u001B[1m Deployed PhySim Successfully using helm chart\u001B[0m')
......@@ -186,7 +183,6 @@ class PhySim:
mySSH.command('oc logout', '\$', 30)
HTML.CreateHtmlTestRow('N/A', 'KO', CONST.OC_PHYSIM_DEPLOY_FAIL)
HTML.CreateHtmlTestRowPhySimTestResult(self.testSummary,self.testResult)
RAN.prematureExit = True
return False
# Waiting to complete the running test
count = 0
......@@ -248,7 +244,6 @@ class PhySim:
HTML.CreateHtmlTestRowPhySimTestResult(self.testSummary,self.testResult)
logging.info('\u001B[1m Physical Simulator Pass\u001B[0m')
else:
RAN.prematureExit = True
if isFinished:
HTML.CreateHtmlTestRow('N/A', 'KO', CONST.ALL_PROCESSES_OK)
else:
......
This diff is collapsed.
......@@ -55,7 +55,6 @@ class RANManagement():
def __init__(self):
self.prematureExit = False
self.ranRepository = ''
self.ranBranch = ''
self.ranAllowMerge = False
......@@ -1269,7 +1268,6 @@ class RANManagement():
rruMsg = 'Slave RRU DID NOT receive the RRU_frame_resynch command from RAU'
logging.debug('\u001B[1;37;41m ' + rruMsg + ' \u001B[0m')
htmleNBFailureMsg += rruMsg + '\n'
self.prematureExit = True
global_status = CONST.ENB_PROCESS_SLAVE_RRU_NOT_SYNCED
if foundSegFault:
logging.debug('\u001B[1;37;41m ' + nodeB_prefix + 'NB ended with a Segmentation Fault! \u001B[0m')
......
......@@ -27,6 +27,9 @@
<htmlTabIcon>wrench</htmlTabIcon>
<TestCaseRequestedList>
000001
000002
000003
000004
</TestCaseRequestedList>
<TestCaseExclusionList></TestCaseExclusionList>
......@@ -37,4 +40,29 @@
<command>true</command>
<command_fail>yes</command_fail>
</testCase>
<testCase id="000002">
<class>Custom_Command</class>
<desc>This should fail</desc>
<node>localhost</node>
<command>false</command>
<command_fail>yes</command_fail>
</testCase>
<testCase id="000003">
<class>Custom_Command</class>
<desc>This should be skipped</desc>
<node>localhost</node>
<command>true</command>
<command_fail>yes</command_fail>
</testCase>
<testCase id="000004">
<class>Custom_Command</class>
<desc>This should be executed because marked so</desc>
<always_exec>true</always_exec>
<node>localhost</node>
<command>true</command>
<command_fail>yes</command_fail>
</testCase>
</testCaseList>
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