summaryrefslogtreecommitdiffstats
path: root/test/integration/targets
diff options
context:
space:
mode:
authorSloane Hertel <shertel@redhat.com>2020-07-30 19:55:29 +0200
committerGitHub <noreply@github.com>2020-07-30 19:55:29 +0200
commit54e2ae79e72cd651c233bbbefc23ae53444980e7 (patch)
treeb3f81632933064e949e419488c1d0398f46fb042 /test/integration/targets
parentlinux facts - return proper broadcast address (#64528) (diff)
downloadansible-54e2ae79e72cd651c233bbbefc23ae53444980e7.tar.xz
ansible-54e2ae79e72cd651c233bbbefc23ae53444980e7.zip
fix downloading collections in git repos and tar.gz artifacts (#70524)
* Fix downloading tar files * Fix downloading SCM collections * changelog
Diffstat (limited to 'test/integration/targets')
-rw-r--r--test/integration/targets/ansible-galaxy-collection-scm/tasks/download.yml36
-rw-r--r--test/integration/targets/ansible-galaxy-collection-scm/tasks/main.yml1
-rw-r--r--test/integration/targets/ansible-galaxy-collection/tasks/download.yml36
3 files changed, 73 insertions, 0 deletions
diff --git a/test/integration/targets/ansible-galaxy-collection-scm/tasks/download.yml b/test/integration/targets/ansible-galaxy-collection-scm/tasks/download.yml
new file mode 100644
index 0000000000..fd1da68b62
--- /dev/null
+++ b/test/integration/targets/ansible-galaxy-collection-scm/tasks/download.yml
@@ -0,0 +1,36 @@
+- name: create test download dir
+ file:
+ path: '{{ galaxy_dir }}/download'
+ state: directory
+
+- name: download a git repository
+ command: 'ansible-galaxy collection download git+https://github.com/ansible-collections/amazon.aws.git,37875c5b4ba5bf3cc43e07edf29f3432fd76def5'
+ args:
+ chdir: '{{ galaxy_dir }}/download'
+ register: download_collection
+
+- name: check that the file was downloaded
+ stat:
+ path: '{{ galaxy_dir }}/download/collections/amazon-aws-1.0.0.tar.gz'
+ register: download_collection_actual
+
+- assert:
+ that:
+ - '"Downloading collection ''amazon.aws'' to" in download_collection.stdout'
+ - download_collection_actual.stat.exists
+
+- name: test the downloaded repository can be installed
+ command: 'ansible-galaxy collection install -r requirements.yml'
+ args:
+ chdir: '{{ galaxy_dir }}/download/collections/'
+
+- name: list installed collections
+ command: 'ansible-galaxy collection list'
+ register: installed_collections
+
+- assert:
+ that:
+ - "'amazon.aws' in installed_collections.stdout"
+
+- include_tasks: ./empty_installed_collections.yml
+ when: cleanup
diff --git a/test/integration/targets/ansible-galaxy-collection-scm/tasks/main.yml b/test/integration/targets/ansible-galaxy-collection-scm/tasks/main.yml
index 500defb878..7db7e1d6e6 100644
--- a/test/integration/targets/ansible-galaxy-collection-scm/tasks/main.yml
+++ b/test/integration/targets/ansible-galaxy-collection-scm/tasks/main.yml
@@ -22,6 +22,7 @@
- include_tasks: ./multi_collection_repo_individual.yml
- include_tasks: ./setup_recursive_scm_dependency.yml
- include_tasks: ./scm_dependency_deduplication.yml
+ - include_tasks: ./download.yml
always:
diff --git a/test/integration/targets/ansible-galaxy-collection/tasks/download.yml b/test/integration/targets/ansible-galaxy-collection/tasks/download.yml
index 008bb7d597..5bb12ec12d 100644
--- a/test/integration/targets/ansible-galaxy-collection/tasks/download.yml
+++ b/test/integration/targets/ansible-galaxy-collection/tasks/download.yml
@@ -104,3 +104,39 @@
assert:
that:
- '"Skipping install, no requirements found" in install_no_requirements.stdout'
+
+- name: Test downloading a tar.gz collection artifact
+ block:
+
+ - 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: result
+
+ - name: create default skeleton
+ command: ansible-galaxy collection init ansible_test.my_collection {{ galaxy_verbosity }}
+ args:
+ chdir: '{{ galaxy_dir }}/scratch'
+ when: not result.stat.exists
+
+ - name: build the tar.gz
+ command: ansible-galaxy collection build {{ galaxy_verbosity }}
+ args:
+ chdir: '{{ galaxy_dir }}/scratch/ansible_test/my_collection'
+ when: not result.stat.exists
+
+ - name: download a tar.gz file
+ command: ansible-galaxy collection download '{{ galaxy_dir }}/scratch/ansible_test/my_collection/ansible_test-my_collection-1.0.0.tar.gz'
+ args:
+ chdir: '{{ galaxy_dir }}/download'
+ register: download_collection
+
+ - name: get result of downloaded tar.gz
+ stat:
+ path: '{{ galaxy_dir }}/download/collections/ansible_test-my_collection-1.0.0.tar.gz'
+ register: download_collection_actual
+
+ - assert:
+ that:
+ - '"Downloading collection ''ansible_test.my_collection'' to" in download_collection.stdout'
+ - download_collection_actual.stat.exists