ansible/test/integration/targets/ansible-galaxy-collection/tasks/build.yml
Jordan Borean 26129fcb80
ansible-galaxy - optimise some paths and use fake galaxy int tests (#67685)
* ansible-galaxy - optimise some paths and use fake galaxy int tests

* Added init, built, and publish tests

* Test against both mocked Galaxy and AH server

* Finish off writing the install tests

* Fix up broken tests

* Rename test target and add migrated tests

* Use cloud provider for Galaxy implementation

* Added blank static config

* Use correct alias group

* Set release version and fix copy typo

* Remove reset step as it is no longer needed

* Use sane env var names for test container name
2020-02-29 08:59:09 +10:00

53 lines
1.9 KiB
YAML

---
- name: build basic collection based on current directory
command: ansible-galaxy collection build
args:
chdir: '{{ galaxy_dir }}/scratch/ansible_test/my_collection'
register: build_current_dir
- name: get result of build basic collection on current directory
stat:
path: '{{ galaxy_dir }}/scratch/ansible_test/my_collection/ansible_test-my_collection-1.0.0.tar.gz'
register: build_current_dir_actual
- name: assert build basic collection based on current directory
assert:
that:
- '"Created collection for ansible_test.my_collection" in build_current_dir.stdout'
- build_current_dir_actual.stat.exists
- name: build basic collection based on relative dir
command: ansible-galaxy collection build scratch/ansible_test/my_collection
args:
chdir: '{{ galaxy_dir }}'
register: build_relative_dir
- name: get result of build basic collection based on relative dir
stat:
path: '{{ galaxy_dir }}/ansible_test-my_collection-1.0.0.tar.gz'
register: build_relative_dir_actual
- name: assert build basic collection based on relative dir
assert:
that:
- '"Created collection for ansible_test.my_collection" in build_relative_dir.stdout'
- build_relative_dir_actual.stat.exists
- name: fail to build existing collection without force
command: ansible-galaxy collection build scratch/ansible_test/my_collection
args:
chdir: '{{ galaxy_dir }}'
ignore_errors: yes
register: build_existing_no_force
- name: build existing collection with force
command: ansible-galaxy collection build scratch/ansible_test/my_collection --force
args:
chdir: '{{ galaxy_dir }}'
register: build_existing_force
- name: assert build existing collection
assert:
that:
- '"use --force to re-create the collection artifact" in build_existing_no_force.stderr'
- '"Created collection for ansible_test.my_collection" in build_existing_force.stdout'