Skip to content

Commit bb75ddf

Browse files
committed
chore: move find_log_message to its only user
This is to keep Microvm trim Signed-off-by: Pablo Barbáchano <[email protected]>
1 parent 8cde159 commit bb75ddf

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

tests/framework/microvm.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import json
1212
import logging
1313
import os
14-
import re
1514
import select
1615
import shutil
1716
import time
@@ -255,7 +254,7 @@ def log_data(self):
255254
"""Return the log data.
256255
257256
!!!!OBS!!!!: Do not use this to check for message existence and
258-
rather use self.check_log_message or self.find_log_message.
257+
rather use self.check_log_message.
259258
"""
260259
with data_lock:
261260
log_data = self.__log_data
@@ -504,13 +503,6 @@ def check_any_log_message(self, messages):
504503
f"`{messages}` were not found in this log: {self.log_data}"
505504
)
506505

507-
@retry(delay=0.1, tries=5)
508-
def find_log_message(self, regex):
509-
"""Wait until `regex` appears in logging output and return it."""
510-
reg_res = re.findall(regex, self.log_data)
511-
assert reg_res
512-
return reg_res
513-
514506
def serial_input(self, input_string):
515507
"""Send a string to the Firecracker serial console via screen."""
516508
input_cmd = 'screen -S {session} -p 0 -X stuff "{input_string}"'

tests/integration_tests/performance/test_boottime.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import platform
66
import re
7+
import time
78

89
from framework.properties import global_props
910
from framework.utils_cpuid import get_cpu_model_name, get_instance_type
@@ -112,7 +113,12 @@ def test_initrd_boottime(test_microvm_with_initrd, record_property, metrics):
112113
def _test_microvm_boottime(vm, max_time_us=MAX_BOOT_TIME_US):
113114
"""Auxiliary function for asserting the expected boot time."""
114115
boot_time_us = 0
115-
timestamps = vm.find_log_message(TIMESTAMP_LOG_REGEX)
116+
timestamps = []
117+
for _ in range(10):
118+
timestamps = re.findall(TIMESTAMP_LOG_REGEX, vm.log_data)
119+
if timestamps:
120+
break
121+
time.sleep(0.1)
116122
if timestamps:
117123
boot_time_us = int(timestamps[0])
118124

0 commit comments

Comments
 (0)