|
| 1 | +--- |
| 2 | +- name: Test container 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_container_repos: |
| 15 | + - name: test_container_repo |
| 16 | + upstream_name: pulp/test-fixture-1 |
| 17 | + url: "https://registry-1.docker.io" |
| 18 | + policy: immediate |
| 19 | + state: present |
| 20 | + |
| 21 | + - include_role: |
| 22 | + name: pulp_distribution |
| 23 | + vars: |
| 24 | + pulp_distribution_container: |
| 25 | + - name: test_container_distribution |
| 26 | + base_path: test_container_distribution |
| 27 | + repository: test_container_repo |
| 28 | + state: present |
| 29 | + - name: test_container_distribution_version_1 |
| 30 | + base_path: test_container_distribution_version_1 |
| 31 | + repository: test_container_repo |
| 32 | + version: 1 |
| 33 | + state: present |
| 34 | + |
| 35 | + - name: Query repository |
| 36 | + pulp.squeezer.container_repository: |
| 37 | + pulp_url: "{{ pulp_url }}" |
| 38 | + username: "{{ pulp_username }}" |
| 39 | + password: "{{ pulp_password }}" |
| 40 | + validate_certs: "{{ pulp_validate_certs }}" |
| 41 | + name: test_container_repo |
| 42 | + register: repo_result |
| 43 | + |
| 44 | + - name: Query distribution |
| 45 | + pulp.squeezer.container_distribution: |
| 46 | + pulp_url: "{{ pulp_url }}" |
| 47 | + username: "{{ pulp_username }}" |
| 48 | + password: "{{ pulp_password }}" |
| 49 | + validate_certs: "{{ pulp_validate_certs }}" |
| 50 | + name: test_container_distribution |
| 51 | + register: dist_result |
| 52 | + |
| 53 | + - name: Query distribution version 1 |
| 54 | + pulp.squeezer.container_distribution: |
| 55 | + pulp_url: "{{ pulp_url }}" |
| 56 | + username: "{{ pulp_username }}" |
| 57 | + password: "{{ pulp_password }}" |
| 58 | + validate_certs: "{{ pulp_validate_certs }}" |
| 59 | + name: test_container_distribution_version_1 |
| 60 | + register: dist_version_1_result |
| 61 | + |
| 62 | + - name: Verify distribution creation |
| 63 | + assert: |
| 64 | + that: |
| 65 | + - dist_result.distribution.name == "test_container_distribution" |
| 66 | + - dist_result.distribution.base_path == "test_container_distribution" |
| 67 | + - dist_result.distribution.repository == repo_result.repository.pulp_href |
| 68 | + - dist_result.distribution.repository_version is none |
| 69 | + |
| 70 | + - name: Verify distribution creation |
| 71 | + assert: |
| 72 | + that: |
| 73 | + - dist_version_1_result.distribution.name == "test_container_distribution_version_1" |
| 74 | + - dist_version_1_result.distribution.base_path == "test_container_distribution_version_1" |
| 75 | + - dist_version_1_result.distribution.repository is none |
| 76 | + - dist_version_1_result.distribution.repository_version == repo_result.repository.latest_version_href |
| 77 | + |
| 78 | + - include_role: |
| 79 | + name: pulp_distribution |
| 80 | + vars: |
| 81 | + pulp_distribution_container: |
| 82 | + - name: test_container_distribution |
| 83 | + state: absent |
| 84 | + - name: test_container_distribution_version_1 |
| 85 | + state: absent |
| 86 | + |
| 87 | + - include_role: |
| 88 | + name: pulp_repository |
| 89 | + vars: |
| 90 | + pulp_repository_container_repos: |
| 91 | + - name: test_container_repo |
| 92 | + state: absent |
| 93 | + |
| 94 | + - name: Query distributions |
| 95 | + pulp.squeezer.container_distribution: |
| 96 | + pulp_url: "{{ pulp_url }}" |
| 97 | + username: "{{ pulp_username }}" |
| 98 | + password: "{{ pulp_password }}" |
| 99 | + validate_certs: "{{ pulp_validate_certs }}" |
| 100 | + register: container_distributions |
| 101 | + |
| 102 | + - name: Verify distribution deletion |
| 103 | + assert: |
| 104 | + that: container_distributions.distributions | length == 0 |
0 commit comments