Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to install v1 requiremets.yml
Fixes: #1376
- Loading branch information
Showing
5 changed files
with
65 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# v1 requirements test file | ||
- src: geerlingguy.mysql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
roles: | ||
- name: geerlingguy.mysql | ||
collections: | ||
- name: ssbarnea.molecule |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
"""Tests related to prerun part of the linter.""" | ||
import os | ||
|
||
from ansiblelint.testing import run_ansible_lint | ||
|
||
|
||
def test_prerun_reqs_v1() -> None: | ||
"""Checks that the linter can auto-install requirements v1 when found.""" | ||
cwd = os.path.realpath( | ||
os.path.join( | ||
os.path.dirname(os.path.realpath(__file__)), "..", "examples", "reqs_v1" | ||
) | ||
) | ||
result = run_ansible_lint(".", cwd=cwd) | ||
assert "Running ansible-galaxy role install" in result.stdout | ||
assert "Running ansible-galaxy collection install" not in result.stdout | ||
assert result.returncode == 0 | ||
|
||
|
||
def test_prerun_reqs_v2() -> None: | ||
"""Checks that the linter can auto-install requirements v2 when found.""" | ||
cwd = os.path.realpath( | ||
os.path.join( | ||
os.path.dirname(os.path.realpath(__file__)), "..", "examples", "reqs_v2" | ||
) | ||
) | ||
result = run_ansible_lint(".", cwd=cwd) | ||
assert "Running ansible-galaxy role install" in result.stdout | ||
assert "Running ansible-galaxy collection install" in result.stdout | ||
assert result.returncode == 0 |