Skip to content

Commit

Permalink
adapt test_ansible_lint_exception to different versions
Browse files Browse the repository at this point in the history
No-Issue
  • Loading branch information
chr-stian committed Jul 5, 2023
1 parent f9f3b02 commit 2cbb6ef
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions galaxy_ng/tests/integration/api/test_artifact_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@

import pytest
from orionutils.generator import build_collection, randstr
from pkg_resources import parse_version

from galaxy_ng.tests.integration.constants import USERNAME_PUBLISHER
from ..conftest import is_hub_4_5
from ..conftest import is_hub_4_5, get_hub_version

from ..utils import (
CapturingGalaxyError,
Expand Down Expand Up @@ -398,7 +399,12 @@ def test_ansible_lint_exception(ansible_config, upload_artifact):

log_messages = [item["message"] for item in resp["messages"]]

linting_re = re.compile("Linting collection via ansible-lint")
pattern = "Linting collection via ansible-lint" # hub 4.8, galaxy-importer 0.4.11
hub_version = get_hub_version(ansible_config)
if parse_version(hub_version) < parse_version('4.8'):
pattern = "Linting role .* via ansible-lint" # 4.7, galaxy-importer 0.4.7

linting_re = re.compile(pattern)
linting = [item for item in log_messages if linting_re.match(item)]
assert len(linting) == 1 # linting occurred

Expand Down

0 comments on commit 2cbb6ef

Please sign in to comment.