fix .0 tests

This commit is contained in:
Bryce Larson 2020-12-09 05:20:25 +00:00
parent e83c3cf226
commit 52a48123a8
No known key found for this signature in database
GPG key ID: 131C38B0F02DB4CA
2 changed files with 4 additions and 3 deletions

View file

@ -41,8 +41,6 @@ def target_python_version():
@pytest.fixture(scope="session") @pytest.fixture(scope="session")
def target_salt_version(): def target_salt_version():
target_salt = os.environ["KITCHEN_SUITE"].split("-", 2)[-1].replace("-", ".") target_salt = os.environ["KITCHEN_SUITE"].split("-", 2)[-1].replace("-", ".")
if target_salt.endswith(".0") and float(target_salt) >= 3000:
target_salt = ".".join(target_salt.split(".")[:-1])
if target_salt in ("latest", "master"): if target_salt in ("latest", "master"):
pytest.skip("Don't have a specific salt version to test against") pytest.skip("Don't have a specific salt version to test against")
return target_salt return target_salt

View file

@ -21,4 +21,7 @@ def test_target_python_version(host, target_python_version):
def test_target_salt_version(host, target_salt_version): def test_target_salt_version(host, target_salt_version):
with host.sudo(): with host.sudo():
ret = host.salt("grains.item", "saltversion", "--timeout=120") ret = host.salt("grains.item", "saltversion", "--timeout=120")
assert ret["saltversion"].startswith(target_salt_version) if target_salt_version.endswith(".0"):
assert ret["saltversion"] == ".".join(target_salt_version.split(".")[:-1])
else:
assert ret["saltversion"].startswith(target_salt_version)