ansible/test/integration/targets/ansible-galaxy-collection/tasks/init.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

44 lines
1.9 KiB
YAML

---
- name: create default skeleton
command: ansible-galaxy collection init ansible_test.my_collection
args:
chdir: '{{ galaxy_dir }}/scratch'
register: init_relative
- name: get result of create default skeleton
find:
path: '{{ galaxy_dir }}/scratch/ansible_test/my_collection'
recurse: yes
file_type: directory
register: init_relative_actual
- debug:
var: init_relative_actual.files | map(attribute='path') | list
- name: assert create default skeleton
assert:
that:
- '"Collection ansible_test.my_collection was created successfully" in init_relative.stdout'
- init_relative_actual.files | length == 3
- (init_relative_actual.files | map(attribute='path') | list)[0] | basename in ['docs', 'plugins', 'roles']
- (init_relative_actual.files | map(attribute='path') | list)[1] | basename in ['docs', 'plugins', 'roles']
- (init_relative_actual.files | map(attribute='path') | list)[2] | basename in ['docs', 'plugins', 'roles']
- name: create collection with custom init path
command: ansible-galaxy collection init ansible_test2.my_collection --init-path "{{ galaxy_dir }}/scratch/custom-init-dir"
register: init_custom_path
- name: get result of create default skeleton
find:
path: '{{ galaxy_dir }}/scratch/custom-init-dir/ansible_test2/my_collection'
file_type: directory
register: init_custom_path_actual
- name: assert create collection with custom init path
assert:
that:
- '"Collection ansible_test2.my_collection was created successfully" in init_custom_path.stdout'
- init_custom_path_actual.files | length == 3
- (init_custom_path_actual.files | map(attribute='path') | list)[0] | basename in ['docs', 'plugins', 'roles']
- (init_custom_path_actual.files | map(attribute='path') | list)[1] | basename in ['docs', 'plugins', 'roles']
- (init_custom_path_actual.files | map(attribute='path') | list)[2] | basename in ['docs', 'plugins', 'roles']