diff mbox series

[ovs-dev,v1] tests: Fix flaky "RBAC -- Recover builtin role and permissions".

Message ID 20261023175714.3991677-1-jtanenba@redhat.com
State Accepted
Delegated to: Dumitru Ceara
Headers show
Series [ovs-dev,v1] tests: Fix flaky "RBAC -- Recover builtin role and permissions". | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success

Commit Message

Jacob Tanenbaum Oct. 23, 2026, 5:57 p.m. UTC
Currently AT_CHECK is called inside of OVS_WAIT_UNTIL macro and that
does not perform as intended. Failing an AT_CHECK exits the test case
subshell so the OVS_WAIT_UNTIL macro never gets the chance to retry.

remove the AT_CHECK from rbr_match_builtin() and rbr_match_custom() so
that OVS_WAIT_UNTIL can rety those functions.

Additionally the regex

s/<[[^<>]]>*//g

causes the error

ovn-sbctl: permissions:Service_Monitor0>: trailing garbage ">" in argument

because it matches one character inside of "<" and an arbitrary number
of ">" exculding "<" and ">". Changing the regex to

s/<[[^<>]]*>//g

so that it will match an arbitrary number of characters inside "<" and
">" excluding ">" and "<".

Fixes: e65fb9efe286 ("northd: Fix issues in RBAC tables recovery.")
Signed-off-by: Jacob Tanenbaum <jtanenba@redhat.com>
---
 tests/ovn-northd.at | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Rosemarie O'Riorden Oct. 28, 2026, 5:53 a.m. UTC | #1
Hi Jacob! These changes make sense to me. Thanks for the flaky test fix!

Acked-by: Rosemarie O'Riorden <rosemarie@redhat.com>

One other random minor thing I noticed in the test is that one of the
ovn-sbctl commands is preceded by a double check ("check check") which
doesn't affect anything but maybe removing that could be folded in upon
merge since we might as well clean up a stray typo in this test while
we're at it.

On 10/23/26 1:57 PM, Jacob Tanenbaum via dev wrote:
> Currently AT_CHECK is called inside of OVS_WAIT_UNTIL macro and that
> does not perform as intended. Failing an AT_CHECK exits the test case
> subshell so the OVS_WAIT_UNTIL macro never gets the chance to retry.
> 
> remove the AT_CHECK from rbr_match_builtin() and rbr_match_custom() so
> that OVS_WAIT_UNTIL can rety those functions.
> 
> Additionally the regex
> 
> s/<[[^<>]]>*//g
> 
> causes the error
> 
> ovn-sbctl: permissions:Service_Monitor0>: trailing garbage ">" in argument
> 
> because it matches one character inside of "<" and an arbitrary number
> of ">" exculding "<" and ">". Changing the regex to
> 
> s/<[[^<>]]*>//g
> 
> so that it will match an arbitrary number of characters inside "<" and
> ">" excluding ">" and "<".
> 
> Fixes: e65fb9efe286 ("northd: Fix issues in RBAC tables recovery.")
> Signed-off-by: Jacob Tanenbaum <jtanenba@redhat.com>
> ---
>  tests/ovn-northd.at | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at
> index d9682f78e..410730cc1 100644
> --- a/tests/ovn-northd.at
> +++ b/tests/ovn-northd.at
> @@ -16703,7 +16703,7 @@ AT_SETUP([RBAC -- Recover builtin role and permissions])
>  ovn_start
>  
>  wait_row_count RBAC_Role 1 name=ovn-controller
> -RBR_BUILTIN_PNAMES=$(fetch_column RBAC_Role permissions name=ovn-controller | uuidfilt | sed -e 's/<[[^<>]]>*//g' | tr -d '=,{}')
> +RBR_BUILTIN_PNAMES=$(fetch_column RBAC_Role permissions name=ovn-controller | uuidfilt | sed -e 's/<[[^<>]]*>//g' | tr -d '=,{}')
>  
>  declare -A RBR_BUILTIN_PERM
>  
> @@ -16714,15 +16714,15 @@ do
>  done
>  
>  rbr_match_builtin() {
> -  local RBR_REAL_PNAMES=$(fetch_column RBAC_Role permissions name=ovn-controller | uuidfilt | sed -e 's/<[[^<>]]>*//g' | tr -d '=,{}')
> +  local RBR_REAL_PNAMES=$(fetch_column RBAC_Role permissions name=ovn-controller | uuidfilt | sed -e 's/<[[^<>]]*>//g' | tr -d '=,{}')
>  
> -  AT_CHECK([test "$RBR_BUILTIN_PNAMES" == "$RBR_REAL_PNAMES"])
> +  test "$RBR_BUILTIN_PNAMES" == "$RBR_REAL_PNAMES" || return 1
>  
>    for V in $RBR_BUILTIN_PNAMES
>    do
>      local _UUID=`ovn-sbctl get RBAC_Role ovn-controller permissions:$V`
>      local RBR_REAL_PERM=`ovn-sbctl get RBAC_Permission $_UUID authorization insert_delete table update | paste -s -d " "`
> -    AT_CHECK([test "${RBR_BUILTIN_PERM[[$V]]}" == "$RBR_REAL_PERM"])
> +    test "${RBR_BUILTIN_PERM[[$V]]}" == "$RBR_REAL_PERM" || return 1
>    done
>  }
>  
> @@ -16735,13 +16735,13 @@ rbr_match_custom() {
>     [[Load_Balancer]]='[[]] false Load_Balancer [[]]'
>    )
>  
> -  AT_CHECK([test "$RBR_BUILTIN_ROLE" == "$RBR_REAL_ROLE"])
> +  test "$RBR_BUILTIN_ROLE" == "$RBR_REAL_ROLE" || return 1
>  
>    for V in $RBR_BUILTIN_PNAMES
>    do
>      local _UUID=`ovn-sbctl get RBAC_Role custom-role permissions:$V`
>      local _PREAL=`ovn-sbctl get RBAC_Permission $_UUID authorization insert_delete table update | paste -s -d " "`
> -    AT_CHECK([test "${RBR_BUILTIN_PERM[[$V]]}" == "$_PREAL"])
> +    test "${RBR_BUILTIN_PERM[[$V]]}" == "$_PREAL" || return 1
>    done
>  }
>
Mark Michelson Nov. 6, 2026, 4:39 p.m. UTC | #2
Thank you Jacob and Rosemarie.

I removed the "check check" that Rosemarie pointed out. I also fixed a
typo in the commit message (s/exculding/excluding/). I pushed the
change to main, branch-26.09 and branch-26.03.

On Fri, Oct 23, 2026 at 2:58 PM Jacob Tanenbaum via dev
<ovs-dev@openvswitch.org> wrote:
>
> Currently AT_CHECK is called inside of OVS_WAIT_UNTIL macro and that
> does not perform as intended. Failing an AT_CHECK exits the test case
> subshell so the OVS_WAIT_UNTIL macro never gets the chance to retry.
>
> remove the AT_CHECK from rbr_match_builtin() and rbr_match_custom() so
> that OVS_WAIT_UNTIL can rety those functions.
>
> Additionally the regex
>
> s/<[[^<>]]>*//g
>
> causes the error
>
> ovn-sbctl: permissions:Service_Monitor0>: trailing garbage ">" in argument
>
> because it matches one character inside of "<" and an arbitrary number
> of ">" exculding "<" and ">". Changing the regex to
>
> s/<[[^<>]]*>//g
>
> so that it will match an arbitrary number of characters inside "<" and
> ">" excluding ">" and "<".
>
> Fixes: e65fb9efe286 ("northd: Fix issues in RBAC tables recovery.")
> Signed-off-by: Jacob Tanenbaum <jtanenba@redhat.com>
> ---
>  tests/ovn-northd.at | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at
> index d9682f78e..410730cc1 100644
> --- a/tests/ovn-northd.at
> +++ b/tests/ovn-northd.at
> @@ -16703,7 +16703,7 @@ AT_SETUP([RBAC -- Recover builtin role and permissions])
>  ovn_start
>
>  wait_row_count RBAC_Role 1 name=ovn-controller
> -RBR_BUILTIN_PNAMES=$(fetch_column RBAC_Role permissions name=ovn-controller | uuidfilt | sed -e 's/<[[^<>]]>*//g' | tr -d '=,{}')
> +RBR_BUILTIN_PNAMES=$(fetch_column RBAC_Role permissions name=ovn-controller | uuidfilt | sed -e 's/<[[^<>]]*>//g' | tr -d '=,{}')
>
>  declare -A RBR_BUILTIN_PERM
>
> @@ -16714,15 +16714,15 @@ do
>  done
>
>  rbr_match_builtin() {
> -  local RBR_REAL_PNAMES=$(fetch_column RBAC_Role permissions name=ovn-controller | uuidfilt | sed -e 's/<[[^<>]]>*//g' | tr -d '=,{}')
> +  local RBR_REAL_PNAMES=$(fetch_column RBAC_Role permissions name=ovn-controller | uuidfilt | sed -e 's/<[[^<>]]*>//g' | tr -d '=,{}')
>
> -  AT_CHECK([test "$RBR_BUILTIN_PNAMES" == "$RBR_REAL_PNAMES"])
> +  test "$RBR_BUILTIN_PNAMES" == "$RBR_REAL_PNAMES" || return 1
>
>    for V in $RBR_BUILTIN_PNAMES
>    do
>      local _UUID=`ovn-sbctl get RBAC_Role ovn-controller permissions:$V`
>      local RBR_REAL_PERM=`ovn-sbctl get RBAC_Permission $_UUID authorization insert_delete table update | paste -s -d " "`
> -    AT_CHECK([test "${RBR_BUILTIN_PERM[[$V]]}" == "$RBR_REAL_PERM"])
> +    test "${RBR_BUILTIN_PERM[[$V]]}" == "$RBR_REAL_PERM" || return 1
>    done
>  }
>
> @@ -16735,13 +16735,13 @@ rbr_match_custom() {
>     [[Load_Balancer]]='[[]] false Load_Balancer [[]]'
>    )
>
> -  AT_CHECK([test "$RBR_BUILTIN_ROLE" == "$RBR_REAL_ROLE"])
> +  test "$RBR_BUILTIN_ROLE" == "$RBR_REAL_ROLE" || return 1
>
>    for V in $RBR_BUILTIN_PNAMES
>    do
>      local _UUID=`ovn-sbctl get RBAC_Role custom-role permissions:$V`
>      local _PREAL=`ovn-sbctl get RBAC_Permission $_UUID authorization insert_delete table update | paste -s -d " "`
> -    AT_CHECK([test "${RBR_BUILTIN_PERM[[$V]]}" == "$_PREAL"])
> +    test "${RBR_BUILTIN_PERM[[$V]]}" == "$_PREAL" || return 1
>    done
>  }
>
> --
> 2.56.0
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
diff mbox series

Patch

diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at
index d9682f78e..410730cc1 100644
--- a/tests/ovn-northd.at
+++ b/tests/ovn-northd.at
@@ -16703,7 +16703,7 @@  AT_SETUP([RBAC -- Recover builtin role and permissions])
 ovn_start
 
 wait_row_count RBAC_Role 1 name=ovn-controller
-RBR_BUILTIN_PNAMES=$(fetch_column RBAC_Role permissions name=ovn-controller | uuidfilt | sed -e 's/<[[^<>]]>*//g' | tr -d '=,{}')
+RBR_BUILTIN_PNAMES=$(fetch_column RBAC_Role permissions name=ovn-controller | uuidfilt | sed -e 's/<[[^<>]]*>//g' | tr -d '=,{}')
 
 declare -A RBR_BUILTIN_PERM
 
@@ -16714,15 +16714,15 @@  do
 done
 
 rbr_match_builtin() {
-  local RBR_REAL_PNAMES=$(fetch_column RBAC_Role permissions name=ovn-controller | uuidfilt | sed -e 's/<[[^<>]]>*//g' | tr -d '=,{}')
+  local RBR_REAL_PNAMES=$(fetch_column RBAC_Role permissions name=ovn-controller | uuidfilt | sed -e 's/<[[^<>]]*>//g' | tr -d '=,{}')
 
-  AT_CHECK([test "$RBR_BUILTIN_PNAMES" == "$RBR_REAL_PNAMES"])
+  test "$RBR_BUILTIN_PNAMES" == "$RBR_REAL_PNAMES" || return 1
 
   for V in $RBR_BUILTIN_PNAMES
   do
     local _UUID=`ovn-sbctl get RBAC_Role ovn-controller permissions:$V`
     local RBR_REAL_PERM=`ovn-sbctl get RBAC_Permission $_UUID authorization insert_delete table update | paste -s -d " "`
-    AT_CHECK([test "${RBR_BUILTIN_PERM[[$V]]}" == "$RBR_REAL_PERM"])
+    test "${RBR_BUILTIN_PERM[[$V]]}" == "$RBR_REAL_PERM" || return 1
   done
 }
 
@@ -16735,13 +16735,13 @@  rbr_match_custom() {
    [[Load_Balancer]]='[[]] false Load_Balancer [[]]'
   )
 
-  AT_CHECK([test "$RBR_BUILTIN_ROLE" == "$RBR_REAL_ROLE"])
+  test "$RBR_BUILTIN_ROLE" == "$RBR_REAL_ROLE" || return 1
 
   for V in $RBR_BUILTIN_PNAMES
   do
     local _UUID=`ovn-sbctl get RBAC_Role custom-role permissions:$V`
     local _PREAL=`ovn-sbctl get RBAC_Permission $_UUID authorization insert_delete table update | paste -s -d " "`
-    AT_CHECK([test "${RBR_BUILTIN_PERM[[$V]]}" == "$_PREAL"])
+    test "${RBR_BUILTIN_PERM[[$V]]}" == "$_PREAL" || return 1
   done
 }