Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test command specific pip requirements/constraints #991

Merged
merged 2 commits into from
Sep 17, 2021
Merged
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
2 changes: 2 additions & 0 deletions roles/ansible-test/defaults/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ ansible_test_network_cli_ssh_type: paramiko
ansible_test_changed: false
ansible_test_base_branch: main
ansible_test_verbosity: "-vvvv"
ansible_test_requirement_files: ['requirements.txt', 'test-requirements.txt']
ansible_test_constraint_files: []
7 changes: 6 additions & 1 deletion roles/ansible-test/tasks/init_collection.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@
_test_location: "{{ ansible_test_collection_dir }}/{{ ansible_test_collection_namespace }}/{{ ansible_test_collection_name }}"
_test_cfg_location: "{{ ansible_test_collection_dir }}/{{ ansible_test_collection_namespace }}/{{ ansible_test_collection_name }}/tests/integration/{{ ansible_test_test_command }}.cfg"

- name: Setup minimum test requirements
set_fact:
_test_requirements: '{% for requirement in ansible_test_requirement_files %} -r {{ _test_location }}/{{ requirement }}{% endfor %}'
_test_constraints: '{% for constraint in ansible_test_constraint_files %} -c {{ _test_location }}/{{ constraint }}{% endfor %}'

- name: Install python requirements
shell: "{{ ansible_test_venv_path }}/bin/pip install -r {{ _test_location }}/requirements.txt -r {{ _test_location }}/test-requirements.txt"
shell: "{{ ansible_test_venv_path }}/bin/pip install {{ _test_requirements }} {{ _test_constraints }}"

- name: Copy potential cloud provider configuration for ansible-test in the collection
shell: "cp -v {{ ansible_test_ansible_path }}/test/integration/cloud-config-*.ini {{ _test_location }}/tests/integration/"
Expand Down
25 changes: 20 additions & 5 deletions zuul.d/ansible-cloud-jobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,14 @@
ansible_test_enable_ara: false
ansible_test_python: 3.6
ansible_test_retry_on_error: true
ansible_test_requirement_files:
- requirements.txt
- test-requirements.txt
# Ansible-test picks up requirements and constraints from
# tests/integration when running in docker, mirror this
- tests/integration/requirements.txt
ansible_test_constraint_files:
- tests/integration/constraints.txt
semaphore: ansible-test-cloud-integration-aws

- job:
Expand Down Expand Up @@ -344,17 +352,24 @@
ansible_test_integration_targets: "{{ child.targets_to_test[5]|join(' ') }}"

#### units
- job:
name: ansible-test-units-community-aws-python38
parent: ansible-test-units-base-python38
vars:
ansible_collections_repo: "{{ zuul.project.canonical_name }}"

- job:
name: ansible-test-units-amazon-aws-python38
parent: ansible-test-units-base-python38
vars:
ansible_collections_repo: "{{ zuul.project.canonical_name }}"
ansible_test_requirement_files:
- requirements.txt
- test-requirements.txt
# Ansible-test picks up requirements and constraints from
# tests/unit when running in docker, mirror this
- tests/unit/requirements.txt
ansible_test_constraint_files:
- tests/unit/constraints.txt

- job:
name: ansible-test-units-community-aws-python38
parent: ansible-test-units-amazon-aws-python38

#### sanity
- job:
Expand Down