summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJafar Al-Gharaibeh <jafar@atcorp.com>2025-03-09 22:22:38 -0500
committerGitHub <noreply@github.com>2025-03-09 22:22:38 -0500
commite28ae87f92982ef08251f16f9e7ab151a605bcd0 (patch)
treea5d4247d59c9c7645d182c328f4c81f88504dd79
parent6080e01918d7a72955ac55bd4239ef8df289c778 (diff)
parent04bdd8d53983bbe97794b1b5860ee6c5a0578c3a (diff)
Merge pull request #18353 from FRRouting/mergify/bp/dev/10.3/pr-18348
Topotest startup order (backport #18348)
-rw-r--r--tests/topotests/lib/topotest.py42
1 files changed, 30 insertions, 12 deletions
diff --git a/tests/topotests/lib/topotest.py b/tests/topotests/lib/topotest.py
index e2c70cdccd..07033698d0 100644
--- a/tests/topotests/lib/topotest.py
+++ b/tests/topotests/lib/topotest.py
@@ -1960,7 +1960,13 @@ class Router(Node):
)
else:
binary = os.path.join(self.daemondir, daemon)
- check_daemon_files.extend([runbase + ".pid", runbase + ".vty"])
+ if daemon == "zebra":
+ zapi_base = "/var/run/{}/zserv.api".format(self.routertype)
+ check_daemon_files.extend(
+ [runbase + ".pid", runbase + ".vty", zapi_base]
+ )
+ else:
+ check_daemon_files.extend([runbase + ".pid", runbase + ".vty"])
cmdenv = "ASAN_OPTIONS="
if asan_abort:
@@ -2244,17 +2250,39 @@ class Router(Node):
else:
logger.debug("%s: %s %s started", self, self.routertype, daemon)
+ # Check if the daemons are running
+ def _check_daemons_running(check_daemon_files):
+ wait_time = 30 if (gdb_routers or gdb_daemons) else 10
+ timeout = Timeout(wait_time)
+ for remaining in timeout:
+ if not check_daemon_files:
+ break
+ check = check_daemon_files[0]
+ if self.path_exists(check):
+ check_daemon_files.pop(0)
+ continue
+ self.logger.debug(
+ "Waiting {}s for {} to appear".format(remaining, check)
+ )
+ time.sleep(0.5)
+
# Start mgmtd first
if "mgmtd" in daemons_list:
start_daemon("mgmtd")
while "mgmtd" in daemons_list:
daemons_list.remove("mgmtd")
+ # Wait till mgmtd is up and running to some
+ # very small extent before moving on
+ _check_daemons_running(check_daemon_files)
# Start Zebra after mgmtd
if "zebra" in daemons_list:
start_daemon("zebra")
while "zebra" in daemons_list:
daemons_list.remove("zebra")
+ # Wait till zebra is up and running to some
+ # very small extent before moving on
+ _check_daemons_running(check_daemon_files)
# Start staticd next if required
if "staticd" in daemons_list:
@@ -2290,17 +2318,7 @@ class Router(Node):
start_daemon(daemon)
# Check if daemons are running.
- wait_time = 30 if (gdb_routers or gdb_daemons) else 10
- timeout = Timeout(wait_time)
- for remaining in timeout:
- if not check_daemon_files:
- break
- check = check_daemon_files[0]
- if self.path_exists(check):
- check_daemon_files.pop(0)
- continue
- self.logger.debug("Waiting {}s for {} to appear".format(remaining, check))
- time.sleep(0.5)
+ _check_daemons_running(check_daemon_files)
if check_daemon_files:
assert False, "Timeout({}) waiting for {} to appear on {}".format(