Skip to content

Commit 3f785c9

Browse files
authored
Merge pull request FRRouting#18348 from donaldsharp/topotest_startup_order
Topotest startup order
2 parents 8f8d092 + 009f42d commit 3f785c9

File tree

1 file changed

+30
-12
lines changed

1 file changed

+30
-12
lines changed

tests/topotests/lib/topotest.py

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1960,7 +1960,13 @@ def do_gdb_or_rr(gdb):
19601960
)
19611961
else:
19621962
binary = os.path.join(self.daemondir, daemon)
1963-
check_daemon_files.extend([runbase + ".pid", runbase + ".vty"])
1963+
if daemon == "zebra":
1964+
zapi_base = "/var/run/{}/zserv.api".format(self.routertype)
1965+
check_daemon_files.extend(
1966+
[runbase + ".pid", runbase + ".vty", zapi_base]
1967+
)
1968+
else:
1969+
check_daemon_files.extend([runbase + ".pid", runbase + ".vty"])
19641970

19651971
cmdenv = "ASAN_OPTIONS="
19661972
if asan_abort:
@@ -2244,17 +2250,39 @@ def emacs_gdb_ready():
22442250
else:
22452251
logger.debug("%s: %s %s started", self, self.routertype, daemon)
22462252

2253+
# Check if the daemons are running
2254+
def _check_daemons_running(check_daemon_files):
2255+
wait_time = 30 if (gdb_routers or gdb_daemons) else 10
2256+
timeout = Timeout(wait_time)
2257+
for remaining in timeout:
2258+
if not check_daemon_files:
2259+
break
2260+
check = check_daemon_files[0]
2261+
if self.path_exists(check):
2262+
check_daemon_files.pop(0)
2263+
continue
2264+
self.logger.debug(
2265+
"Waiting {}s for {} to appear".format(remaining, check)
2266+
)
2267+
time.sleep(0.5)
2268+
22472269
# Start mgmtd first
22482270
if "mgmtd" in daemons_list:
22492271
start_daemon("mgmtd")
22502272
while "mgmtd" in daemons_list:
22512273
daemons_list.remove("mgmtd")
2274+
# Wait till mgmtd is up and running to some
2275+
# very small extent before moving on
2276+
_check_daemons_running(check_daemon_files)
22522277

22532278
# Start Zebra after mgmtd
22542279
if "zebra" in daemons_list:
22552280
start_daemon("zebra")
22562281
while "zebra" in daemons_list:
22572282
daemons_list.remove("zebra")
2283+
# Wait till zebra is up and running to some
2284+
# very small extent before moving on
2285+
_check_daemons_running(check_daemon_files)
22582286

22592287
# Start staticd next if required
22602288
if "staticd" in daemons_list:
@@ -2290,17 +2318,7 @@ def emacs_gdb_ready():
22902318
start_daemon(daemon)
22912319

22922320
# Check if daemons are running.
2293-
wait_time = 30 if (gdb_routers or gdb_daemons) else 10
2294-
timeout = Timeout(wait_time)
2295-
for remaining in timeout:
2296-
if not check_daemon_files:
2297-
break
2298-
check = check_daemon_files[0]
2299-
if self.path_exists(check):
2300-
check_daemon_files.pop(0)
2301-
continue
2302-
self.logger.debug("Waiting {}s for {} to appear".format(remaining, check))
2303-
time.sleep(0.5)
2321+
_check_daemons_running(check_daemon_files)
23042322

23052323
if check_daemon_files:
23062324
assert False, "Timeout({}) waiting for {} to appear on {}".format(

0 commit comments

Comments
 (0)