Make sure that 'container' is returned in more circumstances, and improve documentation when it is actually returned (#178)

* Make sure that 'container' is returned in more circumstances, and improve documentation when it is actually returned.

* Fix typos.
This commit is contained in:
Felix Fontein
2021-07-24 21:01:14 +02:00
committed by GitHub
parent 9b661a6ac2
commit e2785de840
3 changed files with 24 additions and 8 deletions
@@ -615,6 +615,16 @@
register: detach_auto_remove_cleanup
diff: no
- name: detach with cleanup and non-zero status
docker_container:
name: "{{ cname }}"
image: "{{ docker_test_image_alpine }}"
command: '/bin/sh -c "exit 42"'
detach: no
cleanup: yes
register: detach_cleanup_nonzero
ignore_errors: true
- assert:
that:
# NOTE that 'Output' sometimes fails to contain the correct output
@@ -629,6 +639,10 @@
- detach_cleanup.status == 0
# - "'Hello from Docker!' in detach_cleanup.container.Output"
- detach_cleanup_cleanup is not changed
- detach_cleanup_nonzero is failed
- detach_cleanup_nonzero.status == 42
- "'Output' in detach_cleanup_nonzero.container"
- "detach_cleanup_nonzero.container.Output == ''"
- assert:
that:
- "'Cannot retrieve result as auto_remove is enabled' == detach_auto_remove.container.Output"