Collection test (#59488)

* Add missing __init__.py for collection unit tests

* Added more tests for collection install and remove default path
pull/59490/head
Jordan Borean 5 years ago committed by GitHub
parent d9b9e07d0b
commit ba7097cba3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -118,7 +118,7 @@ class GalaxyCLI(CLI):
cinstall_parser.add_argument('args', metavar='collection_name', nargs='*',
help='The collection(s) name or path/url to a tar.gz collection artifact. This '
'is mutually exclusive with --requirements-file.')
cinstall_parser.add_argument('-p', '--collections-path', dest='collections_path', default='./',
cinstall_parser.add_argument('-p', '--collections-path', dest='collections_path', required=True,
help='The path to the directory containing your collections.')
cinstall_parser.add_argument('-i', '--ignore-errors', dest='ignore_errors', action='store_true', default=False,
help='Ignore errors during installation and continue with the next specified '

@ -165,6 +165,31 @@ pushd "${galaxy_testdir}"
[[ -f "${galaxy_testdir}/ansible_test-my_collection-1.0.0.tar.gz" ]]
f_ansible_galaxy_status \
"collection install from local tarball test"
ansible-galaxy collection install "ansible_test-my_collection-1.0.0.tar.gz" -p ./install | tee out.txt
[[ -f "${galaxy_testdir}/install/ansible_collections/ansible_test/my_collection/MANIFEST.json" ]]
grep "Installing 'ansible_test.my_collection:1.0.0' to .*" out.txt
f_ansible_galaxy_status \
"collection install with existing collection and without --force"
ansible-galaxy collection install "ansible_test-my_collection-1.0.0.tar.gz" -p ./install | tee out.txt
[[ -f "${galaxy_testdir}/install/ansible_collections/ansible_test/my_collection/MANIFEST.json" ]]
grep "Skipping 'ansible_test.my_collection' as it is already installed" out.txt
f_ansible_galaxy_status \
"collection install with existing collection and with --force"
ansible-galaxy collection install "ansible_test-my_collection-1.0.0.tar.gz" -p ./install --force | tee out.txt
[[ -f "${galaxy_testdir}/install/ansible_collections/ansible_test/my_collection/MANIFEST.json" ]]
grep "Installing 'ansible_test.my_collection:1.0.0' to .*" out.txt
popd # ${galaxy_testdir}
rm -fr "${galaxy_testdir}"

Loading…
Cancel
Save