From ef3ea4cdc308834307f5158cc113d672b2041588 Mon Sep 17 00:00:00 2001 From: Matt Martz Date: Wed, 18 May 2022 14:34:49 -0500 Subject: [PATCH] Incidental docker chip away (#77830) * Add new templating target, test splitter * Add test for host:port parsing in parse_address via add_host * Test already notified listening handler * Add test for gathering bridge network facts * Add veth to bridge * ci_complete ci_coverage --- .../targets/add_host/tasks/main.yml | 10 ++++++ .../targets/facts_linux_network/aliases | 3 +- .../facts_linux_network/tasks/main.yml | 33 +++++++++++++++++++ .../handlers/test_listening_handlers.yml | 15 +++++++++ test/integration/targets/templating/aliases | 2 ++ .../targets/templating/tasks/main.yml | 8 +++++ 6 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 test/integration/targets/templating/aliases create mode 100644 test/integration/targets/templating/tasks/main.yml diff --git a/test/integration/targets/add_host/tasks/main.yml b/test/integration/targets/add_host/tasks/main.yml index d1583eff31e..d81e6dd2d26 100644 --- a/test/integration/targets/add_host/tasks/main.yml +++ b/test/integration/targets/add_host/tasks/main.yml @@ -174,3 +174,13 @@ - add_host_loop_res.results[1] is changed - add_host_loop_res.results[2] is not changed - add_host_loop_res is changed + +- name: Add host with host:port in name + add_host: + name: '127.0.1.1:2222' + register: hostport + +- assert: + that: + - hostport.add_host.host_name == '127.0.1.1' + - hostport.add_host.host_vars.ansible_ssh_port == 2222 diff --git a/test/integration/targets/facts_linux_network/aliases b/test/integration/targets/facts_linux_network/aliases index 703c532e909..a2d06bbd03a 100644 --- a/test/integration/targets/facts_linux_network/aliases +++ b/test/integration/targets/facts_linux_network/aliases @@ -3,4 +3,5 @@ shippable/posix/group2 skip/freebsd skip/osx skip/macos -context/controller +context/target +destructive diff --git a/test/integration/targets/facts_linux_network/tasks/main.yml b/test/integration/targets/facts_linux_network/tasks/main.yml index af4dde96aa2..6efaf502269 100644 --- a/test/integration/targets/facts_linux_network/tasks/main.yml +++ b/test/integration/targets/facts_linux_network/tasks/main.yml @@ -16,3 +16,36 @@ - name: Remove IP from interface command: ip address delete 100.42.42.1/32 dev {{ ansible_facts.default_ipv4.interface }} ignore_errors: yes + +- block: + - name: Add bridge device + command: ip link add name br1337 type bridge stp_state 1 + + - name: Add virtual interface + command: ip link add name veth1337 type veth + + - name: Add virtual interface to bridge + command: ip link set veth1337 master br1337 + + - name: Gather network facts + setup: + gather_subset: network + + - debug: + var: ansible_facts.br1337 + + - assert: + that: + - ansible_facts.br1337.type == 'bridge' + - ansible_facts.br1337.id != '' + - ansible_facts.br1337.stp is true + - ansible_facts.br1337.interfaces|first == 'veth1337' + + always: + - name: Remove virtual interface + command: ip link delete veth1337 type veth + ignore_errors: yes + + - name: Remove bridge device + command: ip link delete br1337 type bridge + ignore_errors: yes diff --git a/test/integration/targets/handlers/test_listening_handlers.yml b/test/integration/targets/handlers/test_listening_handlers.yml index 67bdad9aa21..f4c3cae4b29 100644 --- a/test/integration/targets/handlers/test_listening_handlers.yml +++ b/test/integration/targets/handlers/test_listening_handlers.yml @@ -7,12 +7,23 @@ command: echo foo notify: - notify_listen + + - name: notify another handler + debug: + changed_when: true + notify: another_listen + + - name: nofity another handler 2 + debug: + changed_when: true + notify: another_listen post_tasks: - name: assert all defined handlers ran without error assert: that: - "notify_listen_ran_1 is defined" - "notify_listen_ran_2 is defined" + - "another_listen_ran is true" handlers: - name: first listening handler has a name set_fact: @@ -22,3 +33,7 @@ - set_fact: notify_listen_ran_2: True listen: notify_listen + + - set_fact: + another_listen_ran: '{{ False if another_listen_ran is defined else True }}' + listen: another_listen diff --git a/test/integration/targets/templating/aliases b/test/integration/targets/templating/aliases new file mode 100644 index 00000000000..13e01f0c947 --- /dev/null +++ b/test/integration/targets/templating/aliases @@ -0,0 +1,2 @@ +shippable/posix/group1 +context/controller diff --git a/test/integration/targets/templating/tasks/main.yml b/test/integration/targets/templating/tasks/main.yml new file mode 100644 index 00000000000..a374eac3031 --- /dev/null +++ b/test/integration/targets/templating/tasks/main.yml @@ -0,0 +1,8 @@ +- command: echo {% raw %}{{ foo }}{% endraw %} + register: result + +- assert: + that: + - result.stdout_lines|first == expected + vars: + expected: !unsafe '{{ foo }}'