diff options
Diffstat (limited to '')
3 files changed, 64 insertions, 0 deletions
diff --git a/test/integration/targets/ansible-galaxy-role/aliases b/test/integration/targets/ansible-galaxy-role/aliases new file mode 100644 index 0000000..8278ec8 --- /dev/null +++ b/test/integration/targets/ansible-galaxy-role/aliases @@ -0,0 +1,2 @@ +shippable/posix/group3 +context/controller diff --git a/test/integration/targets/ansible-galaxy-role/meta/main.yml b/test/integration/targets/ansible-galaxy-role/meta/main.yml new file mode 100644 index 0000000..e6bc9cc --- /dev/null +++ b/test/integration/targets/ansible-galaxy-role/meta/main.yml @@ -0,0 +1 @@ +dependencies: [setup_remote_tmp_dir] diff --git a/test/integration/targets/ansible-galaxy-role/tasks/main.yml b/test/integration/targets/ansible-galaxy-role/tasks/main.yml new file mode 100644 index 0000000..03d0b3c --- /dev/null +++ b/test/integration/targets/ansible-galaxy-role/tasks/main.yml @@ -0,0 +1,61 @@ +- name: Install role from Galaxy (should not fail with AttributeError) + command: ansible-galaxy role install ansible.nope -vvvv --ignore-errors + +- name: Archive directories + file: + state: directory + path: "{{ remote_tmp_dir }}/role.d/{{item}}" + loop: + - meta + - tasks + +- name: Metadata file + copy: + content: "'galaxy_info': {}" + dest: "{{ remote_tmp_dir }}/role.d/meta/main.yml" + +- name: Valid files + copy: + content: "" + dest: "{{ remote_tmp_dir }}/role.d/tasks/{{item}}" + loop: + - "main.yml" + - "valid~file.yml" + +- name: Valid role archive + command: "tar cf {{ remote_tmp_dir }}/valid-role.tar {{ remote_tmp_dir }}/role.d" + +- name: Invalid file + copy: + content: "" + dest: "{{ remote_tmp_dir }}/role.d/tasks/~invalid.yml" + +- name: Valid requirements file + copy: + dest: valid-requirements.yml + content: "[{'src': '{{ remote_tmp_dir }}/valid-role.tar', 'name': 'valid-testrole'}]" + +- name: Invalid role archive + command: "tar cf {{ remote_tmp_dir }}/invalid-role.tar {{ remote_tmp_dir }}/role.d" + +- name: Invalid requirements file + copy: + dest: invalid-requirements.yml + content: "[{'src': '{{ remote_tmp_dir }}/invalid-role.tar', 'name': 'invalid-testrole'}]" + +- name: Install valid role + command: ansible-galaxy install -r valid-requirements.yml + +- name: Uninstall valid role + command: ansible-galaxy role remove valid-testrole + +- name: Install invalid role + command: ansible-galaxy install -r invalid-requirements.yml + ignore_errors: yes + register: invalid + +- assert: + that: "invalid.rc != 0" + +- name: Uninstall invalid role + command: ansible-galaxy role remove invalid-testrole |