From 09ed4df066c565928b5d9366b651ca888194d588 Mon Sep 17 00:00:00 2001 From: Rodolfo Alonso Hernandez Date: Mon, 8 Sep 2025 07:07:17 +0000 Subject: [PATCH] [FT] Randomize the network segment init method starting time The network segment range initialization method in the test ``test_initialize_network_segment_range_support_parallel_execution`` needs to have a random starting time for each thread. This is similar to what will happen in a real environment. With kernel threads, these workers perform the same operation on the DB at the same time. NOTE: the network segment range initialization needs to be improved. That will done in [1], in 2026.1. [1]https://review.opendev.org/c/openstack/neutron/+/947898 Closes-Bug: #2122107 Signed-off-by: Rodolfo Alonso Hernandez Change-Id: I79020a3ad4d0e7db60849939a4030bffe4427834 --- .../tests/functional/plugins/ml2/drivers/test_type_tunnel.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/neutron/tests/functional/plugins/ml2/drivers/test_type_tunnel.py b/neutron/tests/functional/plugins/ml2/drivers/test_type_tunnel.py index 8e9bca7c41d..658f9dfd2db 100644 --- a/neutron/tests/functional/plugins/ml2/drivers/test_type_tunnel.py +++ b/neutron/tests/functional/plugins/ml2/drivers/test_type_tunnel.py @@ -14,6 +14,7 @@ # under the License. from concurrent import futures +import random import time from neutron_lib import constants @@ -37,11 +38,11 @@ def _initialize_network_segment_range_support(type_driver, start_time): # DB transaction. admin_context = context.get_admin_context() with db_api.CONTEXT_WRITER.using(admin_context): + time.sleep(random.randrange(1000) / 1000) type_driver._delete_expired_default_network_segment_ranges( admin_context, start_time) type_driver._populate_new_default_network_segment_ranges( admin_context, start_time) - time.sleep(1) class TunnelTypeDriverBaseTestCase(testlib_api.SqlTestCase):