forked from ansible/ansible-builder
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Fixes bug where we incorrecty assume dnf for python interpreter install - Add pulp tests that verify check_ansible and new pkg manager option
- Loading branch information
Showing
11 changed files
with
128 additions
and
13 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
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
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,14 @@ | ||
--- | ||
version: 3 | ||
|
||
images: | ||
base_image: | ||
name: localhost:8080/testrepo/ubi-minimal:latest | ||
|
||
dependencies: | ||
ansible_runner: ansible_runner | ||
python_interpreter: | ||
package_name: python3 | ||
|
||
options: | ||
package_manager_path: /usr/bin/microdnf |
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,14 @@ | ||
--- | ||
version: 3 | ||
|
||
images: | ||
base_image: | ||
name: localhost:8080/testrepo/ubi-minimal:latest | ||
|
||
dependencies: | ||
ansible_core: ansible_core | ||
python_interpreter: | ||
package_name: python3 | ||
|
||
options: | ||
package_manager_path: /usr/bin/microdnf |
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,14 @@ | ||
--- | ||
version: 3 | ||
|
||
images: | ||
base_image: | ||
name: localhost:8080/testrepo/ubi-minimal:latest | ||
|
||
dependencies: | ||
python_interpreter: | ||
package_name: python3 | ||
|
||
options: | ||
skip_ansible_check: True | ||
package_manager_path: /usr/bin/microdnf |
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,48 @@ | ||
import pytest | ||
import subprocess | ||
|
||
|
||
class TestV3: | ||
|
||
def test_ansible_check_is_skipped(self, cli, tmp_path, data_dir, podman_ee_tag): | ||
""" | ||
Test that the check_ansible script is skipped will NOT cause build failure. | ||
""" | ||
ee_def = data_dir / 'v3' / 'check_ansible' / 'ee-skip.yml' | ||
|
||
result = cli( | ||
f'ansible-builder build -c {tmp_path} -f {ee_def} -t {podman_ee_tag} ' | ||
f'--container-runtime=podman -v3' | ||
) | ||
|
||
assert result.rc == 0 | ||
|
||
def test_missing_ansible(self, cli, tmp_path, data_dir, podman_ee_tag): | ||
""" | ||
Test that the check_ansible script will cause build failure if | ||
ansible-core is not installed. | ||
""" | ||
ee_def = data_dir / 'v3' / 'check_ansible' / 'ee-missing-ansible.yml' | ||
|
||
with pytest.raises(subprocess.CalledProcessError) as einfo: | ||
cli( | ||
f'ansible-builder build -c {tmp_path} -f {ee_def} -t {podman_ee_tag} ' | ||
f'--container-runtime=podman -v3' | ||
) | ||
|
||
assert "ERROR - Missing Ansible installation" in einfo.value.stdout | ||
|
||
def test_missing_runner(self, cli, tmp_path, data_dir, podman_ee_tag): | ||
""" | ||
Test that the check_ansible script will cause build failure if | ||
ansible-runner is not installed. | ||
""" | ||
ee_def = data_dir / 'v3' / 'check_ansible' / 'ee-missing-runner.yml' | ||
|
||
with pytest.raises(subprocess.CalledProcessError) as einfo: | ||
cli( | ||
f'ansible-builder build -c {tmp_path} -f {ee_def} -t {podman_ee_tag} ' | ||
f'--container-runtime=podman -v3' | ||
) | ||
|
||
assert "ERROR - Missing Ansible Runner installation" in einfo.value.stdout |
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