|
| 1 | +--- |
| 2 | +- name: Test pulp_distribution |
| 3 | + gather_facts: false |
| 4 | + hosts: localhost |
| 5 | + vars: |
| 6 | + pulp_url: http://localhost:8080 |
| 7 | + pulp_username: admin |
| 8 | + pulp_password: password |
| 9 | + pulp_validate_certs: true |
| 10 | + tasks: |
| 11 | + - include_role: |
| 12 | + name: pulp_repository |
| 13 | + vars: |
| 14 | + pulp_repository_deb_repos: |
| 15 | + - name: test_deb_repo |
| 16 | + url: "https://fixtures.pulpproject.org/debian/" |
| 17 | + distributions: "ragnarok" |
| 18 | + policy: immediate |
| 19 | + state: present |
| 20 | + |
| 21 | + - include_role: |
| 22 | + name: pulp_publication |
| 23 | + vars: |
| 24 | + pulp_publication_deb: |
| 25 | + - repository: test_deb_repo |
| 26 | + state: present |
| 27 | + |
| 28 | + - include_role: |
| 29 | + name: pulp_distribution |
| 30 | + vars: |
| 31 | + pulp_distribution_deb: |
| 32 | + - name: test_deb_distribution |
| 33 | + base_path: test_deb_distribution |
| 34 | + repository: test_deb_repo |
| 35 | + state: present |
| 36 | + - name: test_deb_distribution_version_1 |
| 37 | + base_path: test_deb_distribution_version_1 |
| 38 | + repository: test_deb_repo |
| 39 | + version: 1 |
| 40 | + state: present |
| 41 | + |
| 42 | + # FIXME: This currently fails due to |
| 43 | + # https://github.com/stackhpc/ansible-collection-pulp/issues/34. |
| 44 | + # - include_role: |
| 45 | + # name: pulp_distribution |
| 46 | + # vars: |
| 47 | + # pulp_distribution_deb: |
| 48 | + # - name: test_deb_distribution_distribution |
| 49 | + # base_path: test_deb_distribution_distribution |
| 50 | + # distribution: test_deb_distribution |
| 51 | + # state: present |
| 52 | + |
| 53 | + - name: Query repository |
| 54 | + pulp.squeezer.deb_repository: |
| 55 | + pulp_url: "{{ pulp_url }}" |
| 56 | + username: "{{ pulp_username }}" |
| 57 | + password: "{{ pulp_password }}" |
| 58 | + validate_certs: "{{ pulp_validate_certs }}" |
| 59 | + name: test_deb_repo |
| 60 | + register: repo_result |
| 61 | + |
| 62 | + - name: Query publication |
| 63 | + pulp.squeezer.deb_publication: |
| 64 | + pulp_url: "{{ pulp_url }}" |
| 65 | + username: "{{ pulp_username }}" |
| 66 | + password: "{{ pulp_password }}" |
| 67 | + validate_certs: "{{ pulp_validate_certs }}" |
| 68 | + repository: test_deb_repo |
| 69 | + version: 1 |
| 70 | + register: pub_result |
| 71 | + |
| 72 | + - name: Query distribution |
| 73 | + pulp.squeezer.deb_distribution: |
| 74 | + pulp_url: "{{ pulp_url }}" |
| 75 | + username: "{{ pulp_username }}" |
| 76 | + password: "{{ pulp_password }}" |
| 77 | + validate_certs: "{{ pulp_validate_certs }}" |
| 78 | + name: test_deb_distribution |
| 79 | + register: dist_result |
| 80 | + |
| 81 | + - name: Query distribution version 1 |
| 82 | + pulp.squeezer.deb_distribution: |
| 83 | + pulp_url: "{{ pulp_url }}" |
| 84 | + username: "{{ pulp_username }}" |
| 85 | + password: "{{ pulp_password }}" |
| 86 | + validate_certs: "{{ pulp_validate_certs }}" |
| 87 | + name: test_deb_distribution_version_1 |
| 88 | + register: dist_version_1_result |
| 89 | + |
| 90 | + # FIXME: This currently fails due to |
| 91 | + # https://github.com/stackhpc/ansible-collection-pulp/issues/34. |
| 92 | + # - name: Query distribution distribution |
| 93 | + # pulp.squeezer.deb_distribution: |
| 94 | + # pulp_url: "{{ pulp_url }}" |
| 95 | + # username: "{{ pulp_username }}" |
| 96 | + # password: "{{ pulp_password }}" |
| 97 | + # validate_certs: "{{ pulp_validate_certs }}" |
| 98 | + # name: test_deb_distribution_distribution |
| 99 | + # register: dist_distribution_result |
| 100 | + |
| 101 | + - name: Verify publication creation |
| 102 | + assert: |
| 103 | + that: |
| 104 | + - pub_result.publication.repository == repo_result.repository.pulp_href |
| 105 | + |
| 106 | + - name: Verify distribution creation |
| 107 | + assert: |
| 108 | + that: |
| 109 | + - dist_result.distribution.name == "test_deb_distribution" |
| 110 | + - dist_result.distribution.base_path == "test_deb_distribution" |
| 111 | + - dist_result.distribution.publication == pub_result.publication.pulp_href |
| 112 | + |
| 113 | + - name: Verify distribution creation |
| 114 | + assert: |
| 115 | + that: |
| 116 | + - dist_version_1_result.distribution.name == "test_deb_distribution_version_1" |
| 117 | + - dist_version_1_result.distribution.base_path == "test_deb_distribution_version_1" |
| 118 | + - dist_version_1_result.distribution.publication == pub_result.publication.pulp_href |
| 119 | + |
| 120 | + # FIXME: This currently fails due to |
| 121 | + # https://github.com/stackhpc/ansible-collection-pulp/issues/34. |
| 122 | + # - name: Verify distribution creation |
| 123 | + # assert: |
| 124 | + # that: |
| 125 | + # - dist_distribution_result.distribution.name == "test_deb_distribution_distribution" |
| 126 | + # - dist_distribution_result.distribution.base_path == "test_deb_distribution_distribution" |
| 127 | + # - dist_distribution_result.distribution.publication == pub_result.publication.pulp_href |
| 128 | + |
| 129 | + - include_role: |
| 130 | + name: pulp_distribution |
| 131 | + vars: |
| 132 | + pulp_distribution_deb: |
| 133 | + - name: test_deb_distribution |
| 134 | + # FIXME: These should not be required. |
| 135 | + repository: test_deb_repo |
| 136 | + base_path: foo |
| 137 | + state: absent |
| 138 | + - name: test_deb_distribution_version_1 |
| 139 | + # FIXME: These should not be required. |
| 140 | + repository: test_deb_repo |
| 141 | + base_path: foo |
| 142 | + state: absent |
| 143 | + - name: test_deb_distribution_distribution |
| 144 | + # FIXME: These should not be required. |
| 145 | + repository: test_deb_repo |
| 146 | + base_path: foo |
| 147 | + state: absent |
| 148 | + |
| 149 | + - include_role: |
| 150 | + name: pulp_publication |
| 151 | + vars: |
| 152 | + pulp_publication_deb: |
| 153 | + - repository: test_deb_repo |
| 154 | + state: absent |
| 155 | + |
| 156 | + - include_role: |
| 157 | + name: pulp_repository |
| 158 | + vars: |
| 159 | + pulp_repository_deb_repos: |
| 160 | + - name: test_deb_repo |
| 161 | + state: absent |
| 162 | + |
| 163 | + - name: Query distributions |
| 164 | + pulp.squeezer.deb_distribution: |
| 165 | + pulp_url: "{{ pulp_url }}" |
| 166 | + username: "{{ pulp_username }}" |
| 167 | + password: "{{ pulp_password }}" |
| 168 | + validate_certs: "{{ pulp_validate_certs }}" |
| 169 | + register: deb_distributions |
| 170 | + |
| 171 | + - name: Verify distribution deletion |
| 172 | + assert: |
| 173 | + that: deb_distributions.distributions | length == 0 |
| 174 | + |
| 175 | + - name: Query publications |
| 176 | + pulp.squeezer.deb_publication: |
| 177 | + pulp_url: "{{ pulp_url }}" |
| 178 | + username: "{{ pulp_username }}" |
| 179 | + password: "{{ pulp_password }}" |
| 180 | + validate_certs: "{{ pulp_validate_certs }}" |
| 181 | + register: deb_publications |
| 182 | + |
| 183 | + - name: Verify publication deletion |
| 184 | + assert: |
| 185 | + that: deb_publications.publications | length == 0 |
0 commit comments