Commit e3547dfb authored by Jaroslava Fiedlerova's avatar Jaroslava Fiedlerova

CI: Modification of log collection in UndeployObject()

After the recent update of matix, collected logs contain color codes
and we did not find the way to switch them completely off.
Replacement of "docker compose logs" by "docker logs" resolves this
issue. This commit includes changes related to "docker logs" usage.
parent 74977924
...@@ -1021,18 +1021,18 @@ class Containerize(): ...@@ -1021,18 +1021,18 @@ class Containerize():
for s in allServices: for s in allServices:
# outputs the hash if the container is running # outputs the hash if the container is running
ret = mySSH.run(f'docker compose -f {yamlDir}/ci-docker-compose.yml ps --all --quiet -- {s}') ret = mySSH.run(f'docker compose -f {yamlDir}/ci-docker-compose.yml ps --all --quiet -- {s}')
running = ret.stdout.splitlines() c = ret.stdout
logging.debug(f'running services: {running}') logging.debug(f'running service {s} with container id {c}')
if ret.stdout != "" and ret.returncode == 0: # something is running for that service if ret.stdout != "" and ret.returncode == 0: # something is running for that service
services.append(s) services.append((s, c))
logging.info(f'stopping services {services}') logging.info(f'stopping services {[s for s, _ in services]}')
mySSH.run(f'docker compose -f {yamlDir}/ci-docker-compose.yml stop -t3') mySSH.run(f'docker compose -f {yamlDir}/ci-docker-compose.yml stop -t3')
copyin_res = True copyin_res = True
for svcName in services: for service_name, container_id in services:
# head -n -1 suppresses the final "X exited with status code Y" # head -n -1 suppresses the final "X exited with status code Y"
filename = f'{svcName}-{HTML.testCase_id}.log' filename = f'{service_name}-{HTML.testCase_id}.log'
mySSH.run(f'docker compose -f {yamlDir}/ci-docker-compose.yml logs --no-log-prefix -- {svcName} &> {lSourcePath}/cmake_targets/log/{filename}') mySSH.run(f'docker logs {container_id} &> {lSourcePath}/cmake_targets/log/{filename}')
copyin_res = mySSH.copyin(f'{lSourcePath}/cmake_targets/log/{filename}', f'{filename}') and copyin_res copyin_res = mySSH.copyin(f'{lSourcePath}/cmake_targets/log/{filename}', f'{filename}') and copyin_res
mySSH.run(f'docker compose -f {yamlDir}/ci-docker-compose.yml down -v') mySSH.run(f'docker compose -f {yamlDir}/ci-docker-compose.yml down -v')
...@@ -1043,7 +1043,7 @@ class Containerize(): ...@@ -1043,7 +1043,7 @@ class Containerize():
HTML.CreateHtmlTestRow('N/A', 'KO', CONST.ENB_PROCESS_NOLOGFILE_TO_ANALYZE) HTML.CreateHtmlTestRow('N/A', 'KO', CONST.ENB_PROCESS_NOLOGFILE_TO_ANALYZE)
self.exitStatus = 1 self.exitStatus = 1
# use function for UE log analysis, when oai-nr-ue container is used # use function for UE log analysis, when oai-nr-ue container is used
elif 'oai-nr-ue' in services or 'lte_ue0' in services: elif any(service_name == 'oai-nr-ue' or service_name == 'lte_ue0' for service_name, _ in services):
self.exitStatus == 0 self.exitStatus == 0
logging.debug(f'Analyzing UE logfile {filename}') logging.debug(f'Analyzing UE logfile {filename}')
logStatus = cls_oaicitest.OaiCiTest().AnalyzeLogFile_UE(f'{filename}', HTML, RAN) logStatus = cls_oaicitest.OaiCiTest().AnalyzeLogFile_UE(f'{filename}', HTML, RAN)
...@@ -1053,12 +1053,12 @@ class Containerize(): ...@@ -1053,12 +1053,12 @@ class Containerize():
else: else:
HTML.CreateHtmlTestRow('UE log Analysis', 'OK', CONST.ALL_PROCESSES_OK) HTML.CreateHtmlTestRow('UE log Analysis', 'OK', CONST.ALL_PROCESSES_OK)
else: else:
for svcName in services: for service_name, _ in services:
if svcName == 'nv-cubb': if service_name == 'nv-cubb':
msg = 'Undeploy PNF/Nvidia CUBB' msg = 'Undeploy PNF/Nvidia CUBB'
HTML.CreateHtmlTestRow(msg, 'OK', CONST.ALL_PROCESSES_OK) HTML.CreateHtmlTestRow(msg, 'OK', CONST.ALL_PROCESSES_OK)
else: else:
filename = f'{svcName}-{HTML.testCase_id}.log' filename = f'{service_name}-{HTML.testCase_id}.log'
logging.debug(f'\u001B[1m Analyzing logfile {filename}\u001B[0m') logging.debug(f'\u001B[1m Analyzing logfile {filename}\u001B[0m')
logStatus = RAN.AnalyzeLogFile_eNB(filename, HTML, self.ran_checkers) logStatus = RAN.AnalyzeLogFile_eNB(filename, HTML, self.ran_checkers)
if (logStatus < 0): if (logStatus < 0):
......
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