From 9a6a5a551697546fd359991f107e5559f9619013 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Tue, 15 Mar 2016 11:58:23 -0700 Subject: [PATCH] add a fact gathering check for the default of all --- test/integration/inventory | 2 +- test/integration/test_gathering_facts.yml | 31 ++++++++++++++++++----- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/test/integration/inventory b/test/integration/inventory index b833343839c..427aa3dc852 100644 --- a/test/integration/inventory +++ b/test/integration/inventory @@ -5,7 +5,7 @@ testhost2 ansible_ssh_host=127.0.0.1 ansible_connection=local testhost3 ansible_ssh_host=127.0.0.3 testhost4 ansible_ssh_host=127.0.0.4 # For testing fact gathering -facthost[0:7] ansible_host=1270.0.0.1 ansible_connection=local +facthost[0:8] ansible_host=1270.0.0.1 ansible_connection=local # the following inline declarations are accompanied diff --git a/test/integration/test_gathering_facts.yml b/test/integration/test_gathering_facts.yml index 8e93be0a8c5..c8a44ea0a7f 100644 --- a/test/integration/test_gathering_facts.yml +++ b/test/integration/test_gathering_facts.yml @@ -1,6 +1,23 @@ --- - hosts: facthost0 + tags: [ 'fact_min' ] + connection: local + gather_subset: "all" + gather_facts: yes + tasks: + - setup: + register: facts + - debug: var=facts + - name: Test that only retrieving minimal facts work + assert: + that: + - '"{{ ansible_user_id|default("UNDEF") }}" != "UNDEF"' + - '"{{ ansible_interfaces|default("UNDEF") }}" != "UNDEF"' + - '"{{ ansible_mounts|default("UNDEF") }}" != "UNDEF"' + - '"{{ ansible_virtualization_role|default("UNDEF") }}" != "UNDEF"' + +- hosts: facthost1 tags: [ 'fact_min' ] connection: local gather_subset: "!all" @@ -14,7 +31,7 @@ - '"{{ ansible_mounts|default("UNDEF") }}" == "UNDEF"' - '"{{ ansible_virtualization_role|default("UNDEF") }}" == "UNDEF"' -- hosts: facthost1 +- hosts: facthost2 tags: [ 'fact_network' ] connection: local gather_subset: "network" @@ -28,7 +45,7 @@ - '"{{ ansible_mounts|default("UNDEF") }}" == "UNDEF"' - '"{{ ansible_virtualization_role|default("UNDEF") }}" == "UNDEF"' -- hosts: facthost2 +- hosts: facthost3 tags: [ 'fact_hardware' ] connection: local gather_subset: "hardware" @@ -42,7 +59,7 @@ - '"{{ ansible_mounts|default("UNDEF") }}" != "UNDEF"' - '"{{ ansible_virtualization_role|default("UNDEF") }}" == "UNDEF"' -- hosts: facthost3 +- hosts: facthost4 tags: [ 'fact_virtual' ] connection: local gather_subset: "virtual" @@ -56,7 +73,7 @@ - '"{{ ansible_mounts|default("UNDEF") }}" == "UNDEF"' - '"{{ ansible_virtualization_role|default("UNDEF") }}" != "UNDEF"' -- hosts: facthost4 +- hosts: facthost5 tags: [ 'fact_comma_string' ] connection: local gather_subset: "virtual,network" @@ -70,7 +87,7 @@ - '"{{ ansible_mounts|default("UNDEF") }}" == "UNDEF"' - '"{{ ansible_virtualization_role|default("UNDEF") }}" != "UNDEF"' -- hosts: facthost5 +- hosts: facthost6 tags: [ 'fact_yaml_list' ] connection: local gather_subset: @@ -86,7 +103,7 @@ - '"{{ ansible_mounts|default("UNDEF") }}" == "UNDEF"' - '"{{ ansible_virtualization_role|default("UNDEF") }}" != "UNDEF"' -- hosts: facthost6 +- hosts: facthost7 tags: [ 'fact_negation' ] connection: local gather_subset: "!hardware" @@ -100,7 +117,7 @@ - '"{{ ansible_mounts|default("UNDEF") }}" == "UNDEF"' - '"{{ ansible_virtualization_role|default("UNDEF") }}" != "UNDEF"' -- hosts: facthost7 +- hosts: facthost8 tags: [ 'fact_mixed_negation_addition' ] connection: local gather_subset: "!hardware,network"