ansible/test/integration/targets/ansible-galaxy-collection-scm/tasks/requirements.yml

104 lines
3.1 KiB
YAML
Raw Normal View History

- name: make a requirements directory
file:
state: directory
path: '{{ galaxy_dir }}/requirements'
- name: populate requirement templates
template:
src: "{{ item }}"
dest: "{{ galaxy_dir }}/requirements/{{ item }}"
loop:
- source_only.yml
- source_and_name.yml
- source_and_name_and_type.yml
- name_without_type.yml
- git_prefix_name.yml
- name_and_type.yml
- name: test source is not a git repo
command: 'ansible-galaxy collection install -r source_only.yml'
register: result
ignore_errors: true
args:
chdir: '{{ galaxy_dir }}/requirements'
- assert:
that:
- result.failed
Replace the inhouse collection dependency resolver with `resolvelib` PR #72591 This change: * Adds an artifacts manager that abstracts away extracting the metadata from artifacts, downloading and caching them in a temporary location. * Adds `resolvelib` to direct ansible-core dependencies[0]. * Implements a `resolvelib`-based dependency resolver for `collection` subcommands that replaces the legacy in-house code. This is a dependency resolution library that pip 20.3+ uses by default. It's now integrated for use for the collection dependency resolution in ansible-galaxy CLI. * Refactors of the `ansible-galaxy collection` CLI. In particular, it: - reimplements most of the `download`, `install`, `list` and `verify` subcommands from scratch; - reuses helper bits previously moved out into external modules; - replaces the old in-house resolver with a more clear implementation based on the resolvelib library[0][1][2]. * Adds a multi Galaxy API proxy layer that abstracts accessing the version and dependencies via API or local artifacts manager. * Makes `GalaxyAPI` instances sortable. * Adds string representation methods to `GalaxyAPI`. * Adds dev representation to `GalaxyAPI`. * Removes unnecessary integration and unit tests. * Aligns the tests with the new expectations. * Adds more tests, integration ones in particular. [0]: https://pypi.org/p/resolvelib [1]: https://github.com/sarugaku/resolvelib [2]: https://pradyunsg.me/blog/2020/03/27/pip-resolver-testing Co-Authored-By: Jordan Borean <jborean93@gmail.com> Co-Authored-By: Matt Clay <matt@mystile.com> Co-Authored-By: Sam Doran <sdoran@redhat.com> Co-Authored-By: Sloane Hertel <shertel@redhat.com> Co-Authored-By: Sviatoslav Sydorenko <webknjaz@redhat.com> Signed-Off-By: Sviatoslav Sydorenko <webknjaz@redhat.com>
2021-01-27 22:23:22 +01:00
- >-
"ERROR! Neither the collection requirement entry key 'name',
nor 'source' point to a concrete resolvable collection artifact.
Also 'name' is not an FQCN. A valid collection name must be in
the format <namespace>.<collection>. Please make sure that the
namespace and the collection name contain characters from
[a-zA-Z0-9_] only." in result.stderr
- name: test source is not a git repo even if name is provided
command: 'ansible-galaxy collection install -r source_and_name.yml'
register: result
ignore_errors: true
args:
chdir: '{{ galaxy_dir }}/requirements'
- assert:
that:
- result.failed
Replace the inhouse collection dependency resolver with `resolvelib` PR #72591 This change: * Adds an artifacts manager that abstracts away extracting the metadata from artifacts, downloading and caching them in a temporary location. * Adds `resolvelib` to direct ansible-core dependencies[0]. * Implements a `resolvelib`-based dependency resolver for `collection` subcommands that replaces the legacy in-house code. This is a dependency resolution library that pip 20.3+ uses by default. It's now integrated for use for the collection dependency resolution in ansible-galaxy CLI. * Refactors of the `ansible-galaxy collection` CLI. In particular, it: - reimplements most of the `download`, `install`, `list` and `verify` subcommands from scratch; - reuses helper bits previously moved out into external modules; - replaces the old in-house resolver with a more clear implementation based on the resolvelib library[0][1][2]. * Adds a multi Galaxy API proxy layer that abstracts accessing the version and dependencies via API or local artifacts manager. * Makes `GalaxyAPI` instances sortable. * Adds string representation methods to `GalaxyAPI`. * Adds dev representation to `GalaxyAPI`. * Removes unnecessary integration and unit tests. * Aligns the tests with the new expectations. * Adds more tests, integration ones in particular. [0]: https://pypi.org/p/resolvelib [1]: https://github.com/sarugaku/resolvelib [2]: https://pradyunsg.me/blog/2020/03/27/pip-resolver-testing Co-Authored-By: Jordan Borean <jborean93@gmail.com> Co-Authored-By: Matt Clay <matt@mystile.com> Co-Authored-By: Sam Doran <sdoran@redhat.com> Co-Authored-By: Sloane Hertel <shertel@redhat.com> Co-Authored-By: Sviatoslav Sydorenko <webknjaz@redhat.com> Signed-Off-By: Sviatoslav Sydorenko <webknjaz@redhat.com>
2021-01-27 22:23:22 +01:00
- >-
result.stderr is search("ERROR! Collections requirement 'source'
entry should contain a valid Galaxy API URL but it does not:
git\+file:///.*/amazon.aws/.git is not an HTTP URL.")
- name: test source is not a git repo even if name and type is provided
command: 'ansible-galaxy collection install -r source_and_name_and_type.yml'
register: result
ignore_errors: true
args:
chdir: '{{ galaxy_dir }}/requirements'
- assert:
that:
- result.failed
Replace the inhouse collection dependency resolver with `resolvelib` PR #72591 This change: * Adds an artifacts manager that abstracts away extracting the metadata from artifacts, downloading and caching them in a temporary location. * Adds `resolvelib` to direct ansible-core dependencies[0]. * Implements a `resolvelib`-based dependency resolver for `collection` subcommands that replaces the legacy in-house code. This is a dependency resolution library that pip 20.3+ uses by default. It's now integrated for use for the collection dependency resolution in ansible-galaxy CLI. * Refactors of the `ansible-galaxy collection` CLI. In particular, it: - reimplements most of the `download`, `install`, `list` and `verify` subcommands from scratch; - reuses helper bits previously moved out into external modules; - replaces the old in-house resolver with a more clear implementation based on the resolvelib library[0][1][2]. * Adds a multi Galaxy API proxy layer that abstracts accessing the version and dependencies via API or local artifacts manager. * Makes `GalaxyAPI` instances sortable. * Adds string representation methods to `GalaxyAPI`. * Adds dev representation to `GalaxyAPI`. * Removes unnecessary integration and unit tests. * Aligns the tests with the new expectations. * Adds more tests, integration ones in particular. [0]: https://pypi.org/p/resolvelib [1]: https://github.com/sarugaku/resolvelib [2]: https://pradyunsg.me/blog/2020/03/27/pip-resolver-testing Co-Authored-By: Jordan Borean <jborean93@gmail.com> Co-Authored-By: Matt Clay <matt@mystile.com> Co-Authored-By: Sam Doran <sdoran@redhat.com> Co-Authored-By: Sloane Hertel <shertel@redhat.com> Co-Authored-By: Sviatoslav Sydorenko <webknjaz@redhat.com> Signed-Off-By: Sviatoslav Sydorenko <webknjaz@redhat.com>
2021-01-27 22:23:22 +01:00
- >-
result.stderr is search("ERROR! Failed to clone a Git repository
from `file:///.*/.git`.")
- >-
result.stderr is search("fatal: '/.*/amazon.aws/.git' does not
appear to be a git repository")
- name: test using name as a git repo without git+ prefix
command: 'ansible-galaxy collection install -r name_without_type.yml'
register: result
ignore_errors: true
args:
chdir: '{{ galaxy_dir }}/requirements'
- assert:
that:
- result.failed
- '"name must be in the format <namespace>.<collection>" in result.stderr'
- name: Clone a git repository
git:
repo: https://github.com/ansible-collections/amazon.aws.git
dest: '{{ galaxy_dir }}/development/amazon.aws/'
- name: test using name as a git repo
command: 'ansible-galaxy collection install -r git_prefix_name.yml'
register: result
args:
chdir: '{{ galaxy_dir }}/requirements'
- name: test using name plus type as a git repo
command: 'ansible-galaxy collection install -r name_and_type.yml --force'
register: result
args:
chdir: '{{ galaxy_dir }}/requirements'
- name: remove the test repo and requirements dir
file:
path: '{{ item }}'
state: absent
loop:
- '{{ galaxy_dir }}/development/amazon.aws/'
- '{{ galaxy_dir }}/requirements'