summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/ansible-galaxy-collection/tasks/fail_fast_resolvelib.yml
blob: eb471f8e7ddd8d8d396b7870382551172558fde7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# resolvelib>=0.6.0 added an 'incompatibilities' parameter to find_matches
# If incompatibilities aren't removed from the viable candidates, this example causes infinite resursion
- name: test resolvelib removes incompatibilites in find_matches and errors quickly (prevent infinite recursion)
  block:
    - name: create collection dir
      file:
        dest: "{{ galaxy_dir }}/resolvelib/ns/coll"
        state: directory

    - name: create galaxy.yml with a dependecy on a galaxy-sourced collection
      copy:
        dest: "{{ galaxy_dir }}/resolvelib/ns/coll/galaxy.yml"
        content: |
                namespace: ns
                name: coll
                authors:
                  - ansible-core
                readme: README.md
                version: "1.0.0"
                dependencies:
                  namespace1.name1: "0.0.5"

    - name: build the collection
      command: ansible-galaxy collection build ns/coll
      args:
        chdir: "{{ galaxy_dir }}/resolvelib"

    - name: install a conflicting version of the dep with the tarfile (expected failure)
      command: ansible-galaxy collection install namespace1.name1:1.0.9 ns-coll-1.0.0.tar.gz -vvvvv -s {{ test_name }} -p collections/
      args:
        chdir: "{{ galaxy_dir }}/resolvelib"
      timeout: 30
      ignore_errors: yes
      register: incompatible

    - assert:
        that:
          - incompatible.failed
          - not incompatible.msg.startswith("The command action failed to execute in the expected time frame")

  always:
    - name: cleanup resolvelib test
      file:
        dest: "{{ galaxy_dir }}/resolvelib"
        state: absent