Package: frr
Version: 10.5.0-1
Severity: normal

Dear maintainer,

here is a small patch with a small improvement to the autopkgtests. It just
adds a function to make sure the services have all started before
continuing with the test.

I found it to be useful on the ubuntu side of things.
commit f828a710a1ee97ae53d71b08de85a70fed4be466
Author: Andreas Hasenack <[email protected]>
Date:   Tue Aug 12 21:25:05 2025 -0300

        - d/t/{utils,zebra-lo,py-frr-reload,bgpd-snmp-rpki}: Add a controlled loop
          to wait for the service to be ready:

diff --git a/debian/tests/bgpd-snmp-rpki b/debian/tests/bgpd-snmp-rpki
index 930b8c26dc..9254350299 100755
--- a/debian/tests/bgpd-snmp-rpki
+++ b/debian/tests/bgpd-snmp-rpki
@@ -1,6 +1,8 @@
 #!/bin/sh
 set -e
 
+. debian/tests/utils
+
 # enable bgpd with SNMP & RPKI modules
 cat >> /etc/frr/daemons <<EOF
 bgpd=yes
@@ -9,6 +11,8 @@ EOF
 
 service frr restart
 
+wait_for_service
+
 # check that it actually started
 pgrep watchfrr
 pgrep zebra
diff --git a/debian/tests/py-frr-reload b/debian/tests/py-frr-reload
index 6dfef33f08..d662cb2f96 100755
--- a/debian/tests/py-frr-reload
+++ b/debian/tests/py-frr-reload
@@ -1,9 +1,13 @@
 #!/bin/sh
 set -e
 
+. debian/tests/utils
+
 # should have been started on install, but policy may have inhibited that
 service frr restart
 
+wait_for_service
+
 # these should be running by default
 pgrep watchfrr
 pgrep zebra
diff --git a/debian/tests/utils b/debian/tests/utils
new file mode 100644
index 0000000000..ac73e3056c
--- /dev/null
+++ b/debian/tests/utils
@@ -0,0 +1,15 @@
+wait_for_service() {
+	i=0
+	limit=10
+	echo -n "Waiting for service to be up and running "
+	while ! vtysh -c "show version" 2>/dev/null | grep -qE "^FRRouting"; do
+	    echo -n .
+	    i=$(($i+1))
+	    if [ ${i} -ge ${limit} ]; then
+	        echo "Failed to start service after ${limit}s, giving up."
+	        return 1
+	    fi
+	    sleep 1s
+	done
+	echo " done!"
+}
diff --git a/debian/tests/zebra-lo b/debian/tests/zebra-lo
index 2a388d5da7..b1b718194a 100755
--- a/debian/tests/zebra-lo
+++ b/debian/tests/zebra-lo
@@ -1,9 +1,13 @@
 #!/bin/sh
 set -e
 
+. debian/tests/utils
+
 # should have been started on install, but policy may have inhibited that
 service frr status >/dev/null || service frr restart
 
+wait_for_service
+
 # these should be running by default
 pgrep watchfrr
 pgrep zebra

Reply via email to