1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/tests/integration/targets/docker_swarm_service/tasks/tests/logging.yml
Ansible Core Team aebc1b03fd Initial commit
2020-03-09 09:11:07 +00:00

158 lines
3.9 KiB
YAML

---
- name: Registering service name
set_fact:
service_name: "{{ name_prefix ~ '-logging' }}"
- name: Registering service name
set_fact:
service_names: "{{ service_names + [service_name] }}"
####################################################################
## logging.driver ##################################################
####################################################################
- name: logging.driver
docker_swarm_service:
name: "{{ service_name }}"
image: alpine:3.8
resolve_image: no
command: '/bin/sh -v -c "sleep 10m"'
logging:
driver: json-file
register: logging_driver_1
- name: logging.driver (idempotency)
docker_swarm_service:
name: "{{ service_name }}"
image: alpine:3.8
resolve_image: no
command: '/bin/sh -v -c "sleep 10m"'
logging:
driver: json-file
register: logging_driver_2
- name: log_driver (idempotency, old name)
docker_swarm_service:
name: "{{ service_name }}"
image: alpine:3.8
resolve_image: no
command: '/bin/sh -v -c "sleep 10m"'
log_driver: json-file
register: logging_driver_2b
- name: logging.driver (change)
docker_swarm_service:
name: "{{ service_name }}"
image: alpine:3.8
resolve_image: no
command: '/bin/sh -v -c "sleep 10m"'
logging:
driver: syslog
register: logging_driver_3
- name: cleanup
docker_swarm_service:
name: "{{ service_name }}"
state: absent
diff: no
- assert:
that:
- logging_driver_1 is changed
- logging_driver_2 is not changed
- logging_driver_2b is not changed
- logging_driver_3 is changed
####################################################################
## logging.options #################################################
####################################################################
- name: logging_options
docker_swarm_service:
name: "{{ service_name }}"
image: alpine:3.8
resolve_image: no
command: '/bin/sh -v -c "sleep 10m"'
logging:
driver: json-file
options:
labels: production_status
env: os,customer
register: logging_options_1
- name: logging_options (idempotency)
docker_swarm_service:
name: "{{ service_name }}"
image: alpine:3.8
resolve_image: no
command: '/bin/sh -v -c "sleep 10m"'
logging:
driver: json-file
options:
env: os,customer
labels: production_status
register: logging_options_2
- name: log_driver_options (idempotency, old name)
docker_swarm_service:
name: "{{ service_name }}"
image: alpine:3.8
resolve_image: no
command: '/bin/sh -v -c "sleep 10m"'
log_driver: json-file
log_driver_options:
env: os,customer
labels: production_status
register: logging_options_2b
- name: logging_options (change)
docker_swarm_service:
name: "{{ service_name }}"
image: alpine:3.8
resolve_image: no
command: '/bin/sh -v -c "sleep 10m"'
logging:
driver: json-file
options:
env: os,customer
labels: production_status
max-file: "1"
register: logging_options_3
- name: logging_options (empty)
docker_swarm_service:
name: "{{ service_name }}"
image: alpine:3.8
resolve_image: no
command: '/bin/sh -v -c "sleep 10m"'
logging:
driver: json-file
options: {}
register: logging_options_4
- name: logging_options (empty idempotency)
docker_swarm_service:
name: "{{ service_name }}"
image: alpine:3.8
resolve_image: no
command: '/bin/sh -v -c "sleep 10m"'
logging:
driver: json-file
options: {}
register: logging_options_5
- name: cleanup
docker_swarm_service:
name: "{{ service_name }}"
state: absent
diff: no
- assert:
that:
- logging_options_1 is changed
- logging_options_2 is not changed
- logging_options_2b is not changed
- logging_options_3 is changed
- logging_options_4 is changed
- logging_options_5 is not changed