Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

Fix versions handling for 6.10 and beyond. #242

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions testfm/decorators.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from distutils.version import StrictVersion as Version

import pytest
import unittest2

Expand All @@ -19,11 +21,11 @@ def run_only_on(*server_version):

from TestFM.decorators import run_only_on

@run_only_on('6.4')
@run_only_on("6.4")
def test_health_check():
# test code continues here

:param str server_version: Enter '6.8', 6.7', '6.6', '6.5', '6.4' and '6.3'
:param str server_version: Enter "6.8", "6.7", "6.6", "6.5", "6.4" and "6.3"
for specific version
"""
prd_version = product()
Expand All @@ -43,15 +45,15 @@ def starts_in(version):

from TestFM.decorators import starts_in

@starts_in(6.6)
@starts_in("6.6")
def test_health_check():
# test code continues here

:param float version: Enter 6.8, 6.7, 6.6, 6.5, 6.4 and 6.3
:param str version: Enter "6.10", "6.9", "6.8.4", and likewise
for specific version
"""
return pytest.mark.skipif(
float(product()) < version,
Version(product()) < Version(version),
reason="Server version is '{}' and this test will run only "
"on {} '{}' onward".format(product(), server(), version),
)
Expand All @@ -66,15 +68,15 @@ def ends_in(version):

from TestFM.decorators import ends_in

@ends_in(6.6)
@ends_in("6.6")
def test_health_check():
# test code continues here

:param float version: Enter 6.7, 6.6, 6.5 , 6.4 , 6.3 , 6.2 and 6.1
:param str version: Enter "6.10", "6.9", "6.8.4", and likewise
for specific version
"""
return pytest.mark.skipif(
float(product()) > version,
Version(product()) > Version(version),
reason="Server version is '{}' and this test will run only "
"on {} <= '{}'".format(product(), server(), version),
)
2 changes: 1 addition & 1 deletion testfm/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def product():
'-a "rpm -q satellite > /dev/null && rpm -q satellite --queryformat=%{VERSION}'
' || rpm -q satellite-capsule --queryformat=%{VERSION}" -o'
).read()
return server_version.splitlines()[0].split(" ")[-1][:3]
return server_version.splitlines()[0].split(" ")[-1]


def run(command):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ def test_negative_backup_online_incremental_nodir(ansible_module):
assert NOPREV_MSG in result["stderr"]


@ends_in(6.7)
@ends_in("6.7")
def test_positive_backup_stopped_dynflowd(setup_backup_tests, ansible_module):
"""Take online backup of server when dynflowd is not running

Expand Down Expand Up @@ -763,7 +763,7 @@ def test_positive_backup_stopped_dynflowd(setup_backup_tests, ansible_module):
assert result["rc"] == 0


@ends_in(6.7)
@ends_in("6.7")
def test_positive_backup_stopped_foreman_tasks(setup_backup_tests, ansible_module):
"""Take online backup of server when foreman-tasks is not running

Expand Down
2 changes: 1 addition & 1 deletion tests/test_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def test_positive_fm_packages_lock(ansible_module):


@pytest.mark.capsule
@starts_in(6.6)
@starts_in("6.6")
def test_positive_lock_package_versions(ansible_module):
"""Verify whether satellite related packages get locked

Expand Down