Wait in both log start track/retrieve

In order to detect correctly duplicates in tested log entries there is
need to wait before and after when logs retrieved or start tracking.

Looking at related code `test_only_accepted_traffic_logged` there are 2
very close code lines [1] that use `ping_ip_address` method (that uses `ping -c1`),
which may generate ICMP traffic that may seem duplicate - 4 log entries of twice request/reply.

This is still suspicious that 4 entries are on same second in timestamp,
but to ensure this isn't test timing fault, lets merge such fix.

[1] https://opendev.org/x/whitebox-neutron-tempest-plugin/src/commit/d08fcd29e9/whitebox_neutron_tempest_plugin/tests/scenario/test_security_group_logging.py#L559-L564

Related-Issue: #OSPRH-14560
Change-Id: Iaa18702edb2c553599657c66b7cb49120a48486e
This commit is contained in:
Maor Blaustein 2025-03-10 13:58:15 +02:00
parent a01def7a72
commit 0bbfd62bb4

View File

@ -217,6 +217,8 @@ class BaseSecGroupLoggingTest(
def _get_logs_and_counts(self, hypervisor_ssh, start_track):
# create dictionary to track values of a hypervisor if it doesn't exist
self._hypervisors_counts.setdefault(hypervisor_ssh.host, dict())
# wait for logging to be done fully, or away from other log events
time.sleep(5)
if start_track:
# tracks A value, before test traffic sent to be logged
_track_value = int(hypervisor_ssh.exec_command(
@ -227,8 +229,6 @@ class BaseSecGroupLoggingTest(
hypervisor_ssh.host, _track_value)
else:
# tracks B value, after test traffic sent to be logged
# (wait time for logging to be done fully).
time.sleep(5)
cmd_outputs = hypervisor_ssh.exec_command(
"sudo grep {} {}".format(self.ENTRY_PTN, self.SG_LOG_FILE),
timeout=120).splitlines()