From 6ca88ab75dacce4f09fb0843be96ad8a6f8e07fa Mon Sep 17 00:00:00 2001 From: Dave Bendit Date: Mon, 29 Oct 2018 16:29:50 -0500 Subject: [PATCH] docker_network: Adding basic integration test for overlay network (#47772) Fixes #19271 --- .../docker_network/tasks/tests/overlay.yml | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 test/integration/targets/docker_network/tasks/tests/overlay.yml diff --git a/test/integration/targets/docker_network/tasks/tests/overlay.yml b/test/integration/targets/docker_network/tasks/tests/overlay.yml new file mode 100644 index 00000000000..59ea6618105 --- /dev/null +++ b/test/integration/targets/docker_network/tasks/tests/overlay.yml @@ -0,0 +1,56 @@ +--- +- name: Registering network name + set_fact: + nname_1: "{{ name_prefix ~ '-network-1' }}" +- name: Registering network name + set_fact: + dnetworks: "{{ dnetworks }} + [nname_1]" + +#################################################################### +## overlay ######################################################### +#################################################################### + +# Overlay networks require swarm initialization before they'll work +- name: swarm + docker_swarm: + state: present + advertise_addr: 192.168.1.1 + +- name: overlay + docker_network: + name: "{{ nname_1 }}" + driver: overlay + driver_options: + com.docker.network.driver.overlay.vxlanid_list: "257" + register: overlay_1 + +- name: overlay (idempotency) + docker_network: + name: "{{ nname_1 }}" + driver: overlay + driver_options: + com.docker.network.driver.overlay.vxlanid_list: "257" + register: overlay_2 + +- name: overlay (change) + docker_network: + name: "{{ nname_1 }}" + driver: bridge + register: overlay_3 + +- name: cleanup network + docker_network: + name: "{{ nname_1 }}" + state: absent + force: yes + +- name: cleanup swarm + docker_swarm: + state: absent + force: yes + +- assert: + that: + - overlay_1 is changed + - overlay_2 is not changed + - overlay_3 is changed