[ovs-dev] [PATCH ovn v4.1 4/7] tests: Eliminate most "sleep" calls.
Ben Pfaff
blp at ovn.org
Thu Nov 12 00:33:19 UTC 2020
On Wed, Nov 11, 2020 at 10:23:02AM +0100, Dumitru Ceara wrote:
> On 11/11/20 2:24 AM, Ben Pfaff wrote:
> > Many of these could be replaced by "ovn-nbctl sync". Some weren't
> > really needed at all because they were adjacent to something that itself
> > called sync or otherwise used --wait. Some were more appropriately
> > done with explicit waits for what was really needed.
> >
> > I left some "sleep"s. Some were because they were "negative" sleeps:
> > they were giving time for something to happen that should *not* happen
> > (in other words, if you wait for it to happen, you'll wait forever,
> > unless there's a bug). Some were because I didn't know how to properly
> > wait for what they were waiting for, or because I didn't understand
> > the circumstances deeply enough.
> >
> > Signed-off-by: Ben Pfaff <blp at ovn.org>
> > ---
>
> As mentioned in the discussion on the V3 of this series, this also needs
> the following incremental to make the "ovn -- /32 router IP address"
> test less racy.
Oh, thanks!
I actually this we could use a way to wait for ports to come up (and
then use it many places). Here's one way:
# wait_for_ports_up [PORT...]
#
# With arguments, waits for specified Logical_Switch_Ports to come up.
# Without arguments, waits for all Logical_Switch_Ports (except
# localnet, localport, and virtual ports) to come up.
wait_for_ports_up() {
if test $# = 0; then
wait_row_count nb:Logical_Switch_Port 0 up!=true type!=localnet type!=localport type!=virtual
else
for port; do
wait_row_count nb:Logical_Switch_Port 1 up=true name=$port
done
fi
}
I'm going to fold this into my series.
More information about the dev
mailing list