Skip to content
Snippets Groups Projects
Commit 37f8872f authored by Raphael Defosseux's avatar Raphael Defosseux
Browse files

chore(ci): printing in robot log.html the shutdown procedure duration for CN containers

parent 09938473
No related branches found
No related tags found
1 merge request!175chore(ci): checking how CN5G containers stop
...@@ -22,6 +22,7 @@ For more information about the OpenAirInterface (OAI) Software Alliance: ...@@ -22,6 +22,7 @@ For more information about the OpenAirInterface (OAI) Software Alliance:
import shutil import shutil
import time import time
import re
from common import * from common import *
from docker_api import DockerApi from docker_api import DockerApi
...@@ -137,7 +138,21 @@ class CNTestLib: ...@@ -137,7 +138,21 @@ class CNTestLib:
log_dir = get_log_dir() log_dir = get_log_dir()
if folder: if folder:
log_dir = os.path.join(log_dir, folder) log_dir = os.path.join(log_dir, folder)
self.docker_api.store_all_logs(log_dir, all_services) cnList = self.docker_api.store_all_logs(log_dir, all_services)
for filename in cnList:
if re.search('mysql', filename) is not None or re.search('oai-ext-dn', filename) is not None or re.search('trace_dummy', filename) is not None:
continue
name_split = filename.split('logs/')
byeMessagePresent = False
with open(filename, 'r') as f:
for line in f:
result = re.search('system.*info.* Bye. Shutdown Procedure took (?P<duration>[0-9]+) ms', line)
if result is not None and not byeMessagePresent:
byeMessagePresent = True
duration = int(result.group('duration'))
print(f'{name_split[1]} container properly shutdown in {duration} ms.')
if not byeMessagePresent:
print(f'{name_split[1]} container did NOT properly shutdown.')
def configure_default_qos(self, five_qi=9, session_ambr=50): def configure_default_qos(self, five_qi=9, session_ambr=50):
print("TODO implement me") print("TODO implement me")
......
...@@ -76,6 +76,7 @@ class DockerApi: ...@@ -76,6 +76,7 @@ class DockerApi:
def store_all_logs(self, log_dir, container_list=None): def store_all_logs(self, log_dir, container_list=None):
containers = self.client.containers(all=True) containers = self.client.containers(all=True)
listOfLogFiles = []
for container in containers: for container in containers:
name = container["Names"][0][1:] name = container["Names"][0][1:]
if container_list and name not in container_list: if container_list and name not in container_list:
...@@ -87,6 +88,8 @@ class DockerApi: ...@@ -87,6 +88,8 @@ class DockerApi:
os.makedirs(log_dir) os.makedirs(log_dir)
with open(file_name, "w") as f: with open(file_name, "w") as f:
f.write(log) f.write(log)
listOfLogFiles.append(file_name)
return listOfLogFiles
def get_log(self, container): def get_log(self, container):
return self.client.logs(container).decode() return self.client.logs(container).decode()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment