Merge "Skip keepalived_respawns test"

This commit is contained in:
Jenkins 2015-12-14 14:57:56 +00:00 committed by Gerrit Code Review
commit cdd2d6c07d
1 changed files with 17 additions and 0 deletions

View File

@ -13,8 +13,12 @@
# License for the specific language governing permissions and limitations
# under the License.
from distutils import version
import re
from oslo_config import cfg
from oslo_log import log as logging
import testtools
from neutron._i18n import _
from neutron.agent.linux import external_process
@ -27,6 +31,18 @@ from neutron.tests.unit.agent.linux import test_keepalived
LOG = logging.getLogger(__name__)
def keepalived_version_not_supported():
try:
cmd = ['keepalived', '--version']
out = utils.execute(cmd, return_stderr=True)
ver = re.search(r"Keepalived v(\d+\.\d+\.\d+)", out[1]).group(1)
return version.LooseVersion(ver) >= version.LooseVersion("1.2.11")
except (OSError, RuntimeError, IndexError, ValueError) as e:
LOG.debug("Exception while checking keepalived version. "
"Exception: %s", e)
return False
class KeepalivedManagerTestCase(base.BaseTestCase,
test_keepalived.KeepalivedConfBaseMixin):
@ -54,6 +70,7 @@ class KeepalivedManagerTestCase(base.BaseTestCase,
self.assertEqual(self.expected_config.get_config_str(),
self.manager.get_conf_on_disk())
@testtools.skipIf(keepalived_version_not_supported(), 'bug/1511311')
def test_keepalived_respawns(self):
self.manager.spawn()
process = self.manager.get_process()