summaryrefslogtreecommitdiff
path: root/smoketest/scripts/cli/test_protocols_ospf.py
diff options
context:
space:
mode:
authorViacheslav Hletenko <v.gletenko@vyos.io>2024-10-03 17:33:46 +0000
committerViacheslav Hletenko <v.gletenko@vyos.io>2024-10-03 17:33:46 +0000
commit23e4ab655e3ef428250763150ae0a6a69fa59859 (patch)
tree2cb1386f93f22cee4be26df56ff9119a9dd6c91b /smoketest/scripts/cli/test_protocols_ospf.py
parente0c643a34f89c9e5f0d2d22f5129354b3f38054e (diff)
downloadvyos-1x-23e4ab655e3ef428250763150ae0a6a69fa59859.tar.gz
vyos-1x-23e4ab655e3ef428250763150ae0a6a69fa59859.zip
T6761: Add timeout for OSPF smoketest fail
From time to time the smoektest script checks frrconfig to early. I.e. FRR does not fully load the config during checking or the OSPF daemon is not started at the time of checking.
Diffstat (limited to 'smoketest/scripts/cli/test_protocols_ospf.py')
-rwxr-xr-xsmoketest/scripts/cli/test_protocols_ospf.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/smoketest/scripts/cli/test_protocols_ospf.py b/smoketest/scripts/cli/test_protocols_ospf.py
index 905eaf2e9..c3ae54e12 100755
--- a/smoketest/scripts/cli/test_protocols_ospf.py
+++ b/smoketest/scripts/cli/test_protocols_ospf.py
@@ -15,6 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import unittest
+import time
from base_vyostest_shim import VyOSUnitTestSHIM
@@ -558,6 +559,22 @@ class TestProtocolsOSPF(VyOSUnitTestSHIM.TestCase):
# Verify FRR ospfd configuration
frrconfig = self.getFRRconfig('router ospf', daemon=PROCESS_NAME)
+ # Required to prevent the race condition T6761
+ retry_count = 0
+ max_retries = 60
+
+ while not frrconfig and retry_count < max_retries:
+ # Log every 10 seconds
+ if retry_count % 10 == 0:
+ print(f"Attempt {retry_count}: FRR config is still empty. Retrying...")
+
+ retry_count += 1
+ time.sleep(1)
+ frrconfig = self.getFRRconfig('router ospf', daemon=PROCESS_NAME)
+
+ if not frrconfig:
+ print("Failed to retrieve FRR config after 60 seconds")
+
self.assertIn(f'router ospf', frrconfig)
self.assertIn(f' network {network} area {area1}', frrconfig)