functional: Stop compiling OVS from source

There is a bug 1640283 fixed in OVS 2.5.1 but currently we ship Neutron
with openvswitch 2.5.0. The patch adds a decorator that skips particular
tests in case minimal version requirement is not met.

Mitaka changes: test case not skipped because there is no such test case
in the branch.

Change-Id: I3a665f3ba770e4acad7e7ead3f8cc557a86952cf
(cherry picked from commit 7210696702)
This commit is contained in:
Jakub Libosvar 2017-02-22 11:44:43 -05:00 committed by Ihar Hrachyshka
parent 0f625d5572
commit bd7c3a7708
2 changed files with 21 additions and 14 deletions

View File

@ -13,6 +13,8 @@
# under the License.
import datetime
from distutils import version
import functools
import os
from oslo_utils import timeutils
@ -20,6 +22,7 @@ import six
import testtools
import neutron
from neutron.agent.common import ovs_lib
from neutron.common import constants
from neutron.common import topics
from neutron import context
@ -193,3 +196,21 @@ def requires_py2(testcase):
def requires_py3(testcase):
return testtools.skipUnless(six.PY3, "requires python 3.x")(testcase)
def skip_if_ovs_older_than(ovs_version):
"""Decorator for test method to skip if OVS version doesn't meet
minimal requirement.
"""
def skip_if_bad_ovs(f):
@functools.wraps(f)
def check_ovs_and_skip(test):
ovs = ovs_lib.BaseOVS()
current_ovs_version = version.StrictVersion(
ovs.config['ovs_version'])
if current_ovs_version < version.StrictVersion(ovs_version):
test.skip("This test requires OVS version %s or higher." %
ovs_version)
return f(test)
return check_ovs_and_skip
return skip_if_bad_ovs

View File

@ -23,20 +23,6 @@ then
configure_host_for_func_testing
if [[ "$VENV" =~ "dsvm-functional" ]]; then
# The OVS_BRANCH variable is used by git checkout. In the case below
# we use a commit on branch-2.5 that fixes compilation with the
# latest ubuntu trusty kernel.
OVS_BRANCH="a35342879f1a7d8b1503d4945bd0791c58f5fc87"
for package in openvswitch openvswitch-switch openvswitch-common; do
if is_package_installed $package; then
uninstall_package $package
fi
done
compile_ovs True /usr /var
start_new_ovs
fi
# Make the workspace owned by the stack user
sudo chown -R $STACK_USER:$STACK_USER $BASE