summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/ansible-galaxy-collection-scm/tasks/test_invalid_version.yml
blob: 1f22bb8bf88f4f8064742de2070f1d695703d501 (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
46
47
48
49
50
51
52
53
54
55
56
57
58
- block:
  - name: test installing a collection with an invalid float version value
    command: 'ansible-galaxy collection install git+file://{{ test_error_repo_path }}/.git#float_version_collection -vvvvvv'
    ignore_errors: yes
    register: invalid_version_result

  - assert:
      that:
        - invalid_version_result is failed
        - msg in invalid_version_result.stderr
    vars:
      req: error_test.float_version_collection:1.0
      ver: "1.0 (<class 'float'>)"
      msg: "Invalid version found for the collection '{{ req }}': {{ ver }}. A SemVer-compliant version or '*' is required."

  - name: test installing a collection with an invalid non-SemVer string version value
    command: 'ansible-galaxy collection install git+file://{{ test_error_repo_path }}/.git#not_semantic_version_collection -vvvvvv'
    ignore_errors: yes
    register: invalid_version_result

  - assert:
      that:
        - invalid_version_result is failed
        - msg in invalid_version_result.stderr
    vars:
      req: error_test.not_semantic_version_collection:1.0
      ver: "1.0 (<class 'str'>)"
      msg: "Invalid version found for the collection '{{ req }}': {{ ver }}. A SemVer-compliant version or '*' is required."

  - name: test installing a collection with an invalid list version value
    command: 'ansible-galaxy collection install git+file://{{ test_error_repo_path }}/.git#list_version_collection -vvvvvv'
    ignore_errors: yes
    register: invalid_version_result

  - assert:
      that:
        - invalid_version_result is failed
        - msg in invalid_version_result.stderr
    vars:
      req: "error_test.list_version_collection:['1.0.0']"
      msg: "Invalid version found for the collection '{{ req }}'. A SemVer-compliant version or '*' is required."

  - name: test installing a collection with an invalid dict version value
    command: 'ansible-galaxy collection install git+file://{{ test_error_repo_path }}/.git#dict_version_collection -vvvvvv'
    ignore_errors: yes
    register: invalid_version_result

  - assert:
      that:
        - invalid_version_result is failed
        - msg in invalid_version_result.stderr
    vars:
      req: "error_test.dict_version_collection:{'broken': 'version'}"
      msg: "Invalid version found for the collection '{{ req }}'. A SemVer-compliant version or '*' is required."

  always:
  - include_tasks: ./empty_installed_collections.yml
    when: cleanup