docker_* tests: check API version (#48620)

* Check minimal API and docker-py versions for all docker_* tests.

* Improve docker_swarm creation/destruction for tests.

* Fail when conditions aren't met.

* Don't hardcode address for advertise_addr.
This commit is contained in:
Felix Fontein
2018-11-19 11:01:40 +01:00
committed by John R Barker
parent 891687284f
commit 3bb41ccb8e
20 changed files with 537 additions and 481 deletions

View File

@@ -27,7 +27,7 @@
images: yes
networks: yes
volumes: yes
builder_cache: yes
builder_cache: "{{ docker_py_version is version('3.3.0', '>=') }}"
register: result
# Analyze result
@@ -56,5 +56,7 @@
- debug: var=result
# Skip for CentOS 6
when: ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6
when: docker_py_version is version('2.1.0', '>=') and docker_api_version is version('1.25', '>=')
- fail: msg="Too old docker / docker-py version to run docker_prune tests!"
when: not(docker_py_version is version('2.1.0', '>=') and docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)