From 5430169b779aed19a75f3b6e83e5112ee49bdcd9 Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Fri, 10 Jul 2015 10:56:14 -0400 Subject: [PATCH] Cleaning up includes test to match 2.0 behavior * Perhaps the only precedence change, in 2.0+ variables from set_fact will not override params to an include file, as params are expected to be more specific than host-based variables. * Uncommented long-form include example. --- .../roles/test_includes/tasks/main.yml | 45 ++++++++++--------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/test/integration/roles/test_includes/tasks/main.yml b/test/integration/roles/test_includes/tasks/main.yml index fb76841fdab..b4808412bef 100644 --- a/test/integration/roles/test_includes/tasks/main.yml +++ b/test/integration/roles/test_includes/tasks/main.yml @@ -26,12 +26,16 @@ - "cb == '2'" - "cc == '3'" -# Fact takes precedence over include param as fact is host-specific - set_fact: a: 101 b: 102 c: 103 +# Params specified via k=v values are strings, while those +# that come from variables will keep the type they were previously. +# Prior to v2.0, facts too priority over include params, however +# this is no longer the case. + - include: included_task1.yml a={{a}} b={{b}} c=103 - name: verify variable include params @@ -39,7 +43,7 @@ that: - "ca == 101" - "cb == 102" - - "cc == 103" + - "cc == '103'" # Test that strings are not turned into numbers - set_fact: @@ -57,26 +61,23 @@ - "cc == '103'" # now try long form includes -# -# FIXME: not sure if folks were using this, or if vars were top level, but seems like -# it should be a thing. -# -#- include: included_task1.yml -# vars: -# a: 201 -# b: 202 -# c: 203 -# -#- debug: var=a -#- debug: var=b -#- debug: var=c -# -#- name: verify long-form include params -# assert: -# that: -# - "ca == 201" -# - "cb == 202" -# - "cc == 203" + +- include: included_task1.yml + vars: + a: 201 + b: 202 + c: 203 + +- debug: var=a +- debug: var=b +- debug: var=c + +- name: verify long-form include params + assert: + that: + - "ca == 201" + - "cb == 202" + - "cc == 203" - name: test handlers with includes shell: echo 1