mirror of
https://github.com/ansible-collections/community.docker.git
synced 2026-07-29 11:55:04 +00:00
docker_api connection plugin (#40)
* Add basic docker_api connection test. * Split AnsibleDockerClient into module-independent and module-specific part. * Mention new connection plugin. * Fix tests. * Add first version of docker_api connection plugin. * Linting. * Fix references. * Improve connection tests. * Fix put_file for all Python versions. * Fix fetch_file. * Linting. * Update plugins/connection/docker_api.py Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru> * Move potential common code to module_utils / plugin_utils. * Move socket_handler to plugin_utils. * Fix typo. Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
This commit is contained in:
@@ -18,8 +18,9 @@ fi
|
||||
|
||||
# Test phase
|
||||
|
||||
CONTAINER_SUFFIX=-${RANDOM}
|
||||
|
||||
DOCKER_CONTAINERS="docker-connection-test-container"
|
||||
DOCKER_CONTAINERS="docker-connection-test-container${CONTAINER_SUFFIX}"
|
||||
|
||||
[[ -n "$DEBUG" || -n "$ANSIBLE_DEBUG" ]] && set -x
|
||||
|
||||
@@ -38,7 +39,7 @@ trap cleanup INT TERM EXIT
|
||||
|
||||
echo "Start containers"
|
||||
for CONTAINER in ${DOCKER_CONTAINERS}; do
|
||||
if [ "${ANSIBLE_TEST_COVERAGE}" == "" ]; then
|
||||
if [ "${ANSIBLE_TEST_COVERAGE:-}" == "" ]; then
|
||||
docker run --rm --name ${CONTAINER} --detach "${IMAGE}" /bin/sh -c 'sleep 10m'
|
||||
else
|
||||
docker run --rm --name ${CONTAINER} --detach -v /tmp:/tmp "${IMAGE}" /bin/sh -c 'sleep 10m'
|
||||
@@ -47,5 +48,16 @@ for CONTAINER in ${DOCKER_CONTAINERS}; do
|
||||
echo ${CONTAINER}
|
||||
done
|
||||
|
||||
cat > test_connection.inventory << EOF
|
||||
[docker]
|
||||
docker-no-pipelining ansible_pipelining=false
|
||||
docker-pipelining ansible_pipelining=true
|
||||
|
||||
[docker:vars]
|
||||
ansible_host=docker-connection-test-container${CONTAINER_SUFFIX}
|
||||
ansible_connection=community.docker.docker
|
||||
ansible_python_interpreter=/usr/local/bin/python3
|
||||
EOF
|
||||
|
||||
echo "Run tests"
|
||||
./runme-connection.sh
|
||||
./runme-connection.sh "$@"
|
||||
|
||||
Reference in New Issue
Block a user