diff mbox series

[ovs-dev,v6,02/12] test: Fix options:requested-chassis with hostname

Message ID 20210928155325.2290444-3-frode.nordahl@canonical.com
State Changes Requested
Headers show
Series Introduce infrastructure for plug providers | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/github-robot-_ovn-kubernetes fail github build: failed

Commit Message

Frode Nordahl Sept. 28, 2021, 3:53 p.m. UTC
This test currently passes, but is broken in two ways.

1) The `fetch_column` helper should be used to retrieve the value
   of hostname, not `fetch` wich results in a "fetch: command not
   found" error which is currently not caught by the test.  As a
   consequence the requested-chassis option was set to the empty
   string ("") and not the chassis hostname.

2) When we introduced testing with TLS+RBAC in c948d6bb05b4 the
   ovn_az_attach helper was updated to set the hostname to match
   system-id.  This of course also makes the name and hostname
   columns in the Chassis record contain the same value which made
   this test no longer do what it says on the tin.

Update test to explicitly set the value to be used for
requested-chassis option in the Chassis hostname record, and
add a check for it not being empty nor equal to chassis name.

Fixes: 4afe409e95c7 ("tests: Introduce new testing helpers.")
Fixes: c948d6bb05b4 ("tests: Test with SSL and RBAC for controller by default")
Signed-off-by: Frode Nordahl <frode.nordahl@canonical.com>
---
 tests/ovn.at | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Numan Siddique Oct. 5, 2021, 2:38 a.m. UTC | #1
On Tue, Sep 28, 2021 at 11:54 AM Frode Nordahl
<frode.nordahl@canonical.com> wrote:
>
> This test currently passes, but is broken in two ways.
>
> 1) The `fetch_column` helper should be used to retrieve the value
>    of hostname, not `fetch` wich results in a "fetch: command not
>    found" error which is currently not caught by the test.  As a
>    consequence the requested-chassis option was set to the empty
>    string ("") and not the chassis hostname.
>
> 2) When we introduced testing with TLS+RBAC in c948d6bb05b4 the
>    ovn_az_attach helper was updated to set the hostname to match
>    system-id.  This of course also makes the name and hostname
>    columns in the Chassis record contain the same value which made
>    this test no longer do what it says on the tin.
>
> Update test to explicitly set the value to be used for
> requested-chassis option in the Chassis hostname record, and
> add a check for it not being empty nor equal to chassis name.
>
> Fixes: 4afe409e95c7 ("tests: Introduce new testing helpers.")
> Fixes: c948d6bb05b4 ("tests: Test with SSL and RBAC for controller by default")
> Signed-off-by: Frode Nordahl <frode.nordahl@canonical.com>

Since this patch is fixing an existing issue, I went ahead and applied
this patch to
the main branch and branch-21.09.

Thanks
Numan

> ---
>  tests/ovn.at | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/tests/ovn.at b/tests/ovn.at
> index 172b5c713..13e97cfd2 100644
> --- a/tests/ovn.at
> +++ b/tests/ovn.at
> @@ -13471,13 +13471,15 @@ ovn-nbctl lsp-add ls0 lsp0
>  net_add n1
>  sim_add hv1
>  as hv1
> +ovs-vsctl set Open_vSwitch . external-ids:hostname=hv1-hostname
>  ovs-vsctl add-br br-phys
>  ovn_attach n1 br-phys 192.168.0.11
>  ovs-vsctl -- add-port br-int hv1-vif0 -- set Interface hv1-vif0 ofport-request=1
>
>  wait_row_count Chassis 1 name=hv1
> -hv1_hostname=$(fetch Chassis hostname name=hv1)
> +hv1_hostname=$(fetch_column Chassis hostname name=hv1)
>  echo "hv1_hostname=${hv1_hostname}"
> +AT_CHECK([test -n "${hv1_hostname}" -a "${hv1_hostname}" != hv1], [1], [])
>  check ovn-nbctl --wait=hv lsp-set-options lsp0 requested-chassis=${hv1_hostname}
>  as hv1 ovs-vsctl set interface hv1-vif0 external-ids:iface-id=lsp0
>
> --
> 2.32.0
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
diff mbox series

Patch

diff --git a/tests/ovn.at b/tests/ovn.at
index 172b5c713..13e97cfd2 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -13471,13 +13471,15 @@  ovn-nbctl lsp-add ls0 lsp0
 net_add n1
 sim_add hv1
 as hv1
+ovs-vsctl set Open_vSwitch . external-ids:hostname=hv1-hostname
 ovs-vsctl add-br br-phys
 ovn_attach n1 br-phys 192.168.0.11
 ovs-vsctl -- add-port br-int hv1-vif0 -- set Interface hv1-vif0 ofport-request=1
 
 wait_row_count Chassis 1 name=hv1
-hv1_hostname=$(fetch Chassis hostname name=hv1)
+hv1_hostname=$(fetch_column Chassis hostname name=hv1)
 echo "hv1_hostname=${hv1_hostname}"
+AT_CHECK([test -n "${hv1_hostname}" -a "${hv1_hostname}" != hv1], [1], [])
 check ovn-nbctl --wait=hv lsp-set-options lsp0 requested-chassis=${hv1_hostname}
 as hv1 ovs-vsctl set interface hv1-vif0 external-ids:iface-id=lsp0