[ovs-dev] [PATCH] ovs-vswitchd.at: Add test for switch over to another ovs-vswitchd.

Gurucharan Shetty shettyg at nicira.com
Mon Oct 6 15:47:01 UTC 2014


This one fails on Windows as it is a little tricky to get it to work
with "$!".

The following works for Windows (and Linux too, atleast for one run).
If the changes that I am proposing end up not testing the original
issue the way you intended, then I am fine with adding a
AT_SKIP_IF([test "$IS_WIN32" = "yes"])




AT_SETUP([ovs-vswitchd -- start additional ovs-vswitchd process])
OVS_VSWITCHD_START

# start another ovs-vswitchd process.
ovs-vswitchd --log-file=fakelog --unixctl="`pwd`"/unixctl &

# sleep for a while
sleep 5

# stop the process.
ovs-appctl -t `pwd`/unixctl exit

# check the fakelog, should only see one ERR for reporting
# the existing ovs-vswitchd process.
AT_CHECK([test `grep ERR fakelog | wc -l` -eq 1])

AT_CHECK([grep ERR fakelog | sed -e 's/^.*ERR|//; s/pid [[0-9]]*//'], [0], [dnl
another ovs-vswitchd process is running, disabling this process ()
until it goes away
])

OVS_VSWITCHD_STOP
AT_CLEANUP

On Fri, Oct 3, 2014 at 3:34 PM, Alex Wang <alexw at nicira.com> wrote:
> Thx Joe, also ran the test on freebsd... worked fine~
>
> Guru will help me test on windows env later~
>
> Applied to master
>
> On Thu, Oct 2, 2014 at 9:26 PM, Joe Stringer <joestringer at nicira.com> wrote:
>
>> Acked-by: Joe Stringer <joestringer at nicira.com>
>>
>> On 2 October 2014 07:44, Alex Wang <alexw at nicira.com> wrote:
>>
>>> Test the switch over to inactive ovs-vswitchd process when user
>>> kill the currently active ovs-vswitchd.
>>>
>>> Signed-off-by: Alex Wang <alexw at nicira.com>
>>> ---
>>>  tests/ovs-vswitchd.at |   41 +++++++++++++++++++++++++++++++++++++++++
>>>  1 file changed, 41 insertions(+)
>>>
>>> diff --git a/tests/ovs-vswitchd.at b/tests/ovs-vswitchd.at
>>> index 1040caa..ec6030f 100644
>>> --- a/tests/ovs-vswitchd.at
>>> +++ b/tests/ovs-vswitchd.at
>>> @@ -98,3 +98,44 @@ another ovs-vswitchd process is running, disabling
>>> this process () until it goes
>>>
>>>  OVS_VSWITCHD_STOP
>>>  AT_CLEANUP
>>> +
>>> +dnl
>>> ----------------------------------------------------------------------
>>> +AT_SETUP([ovs-vswitchd -- switch over to another ovs-vswitchd process])
>>> +OVS_VSWITCHD_START
>>> +
>>> +# start a new ovs-vswitchd process.
>>> +ovs-vswitchd --log-file=fakelog --enable-dummy &
>>> +pid=`echo $!`
>>> +
>>> +# sleep for a while.
>>> +sleep 5
>>> +
>>> +# kill the current active ovs-vswitchd process.
>>> +kill `cat ovs-vswitchd.pid`
>>> +
>>> +sleep 5
>>> +
>>> +# check the creation of br0 on the new ovs-vswitchd process.
>>> +AT_CHECK([grep "bridge br0" fakelog | sed -e 's/port [[0-9]]*$/port/;
>>> +s/datapath ID [[a-z0-9]]*$/datapath ID/;s/^.*INFO|//'], [0], [dnl
>>> +bridge br0: added interface br0 on port
>>> +bridge br0: using datapath ID
>>> +])
>>> +
>>> +# stop the process.
>>> +kill $pid
>>> +
>>> +# check the fakelog, should not see WARN/ERR/EMER log other than the one
>>> +# for reporting the existing ovs-vswitchd process and the one for killing
>>> +# the process.
>>> +AT_CHECK([sed -n "
>>> +/|ERR|another ovs-vswitchd process is running/d
>>> +/|WARN|terminating with signal/d
>>> +/|WARN|/p
>>> +/|ERR|/p
>>> +/|EMER|/p" fakelog
>>> +])
>>> +
>>> +# cleanup.
>>> +kill `cat ovsdb-server.pid`
>>> +AT_CLEANUP
>>> --
>>> 1.7.9.5
>>>
>>>
>>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev



More information about the dev mailing list