From 4002a7c317803c84eacf5d3562d3ff5eb569ce9a Mon Sep 17 00:00:00 2001 From: Ch3LL Date: Thu, 1 Nov 2018 14:31:22 -0400 Subject: [PATCH] Fix test_issue_30161_unless_and_onlyif_together for MacOSX --- .../files/file/base/issue-30161.sls | 47 ++++++++----------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/tests/integration/files/file/base/issue-30161.sls b/tests/integration/files/file/base/issue-30161.sls index 9546f35ced..89024d98fd 100644 --- a/tests/integration/files/file/base/issue-30161.sls +++ b/tests/integration/files/file/base/issue-30161.sls @@ -1,44 +1,35 @@ +{% if grains['os'] == 'Windows' %} + {% set test_false = 'cmd.exe /c exit 1' %} + {% set test_true = 'cmd.exe /c exit 0' %} +{% elif grains['os'] == 'MacOS' %} + {% set test_false = '/usr/bin/false' %} + {% set test_true = '/usr/bin/true' %} +{% else %} + {% set test_false = '/bin/false' %} + {% set test_true = '/bin/true' %} +{% endif %} + unless_false_onlyif_true: file.managed: - name: {{ salt['runtests_helpers.get_salt_temp_dir_for_path']('test.txt') }} -{% if grains['os'] == 'Windows' %} - - unless: cmd.exe /c exit 1 - - onlyif: cmd.exe /c exit 0 -{% else %} - - unless: /bin/false - - onlyif: /bin/true -{% endif %} + - unless: {{ test_false }} + - onlyif: {{ test_true }} unless_true_onlyif_false: file.managed: - name: {{ salt['runtests_helpers.get_salt_temp_dir_for_path']('test.txt') }} -{% if grains['os'] == 'Windows' %} - - unless: cmd.exe /c exit 0 - - onlyif: cmd.exe /c exit 1 -{% else %} - - unless: /bin/true - - onlyif: /bin/false -{% endif %} + - unless: {{ test_true }} + - onlyif: {{ test_false }} unless_true_onlyif_true: file.managed: - name: {{ salt['runtests_helpers.get_salt_temp_dir_for_path']('test.txt') }} -{% if grains['os'] == 'Windows' %} - - unless: cmd.exe /c exit 0 - - onlyif: cmd.exe /c exit 0 -{% else %} - - unless: /bin/true - - onlyif: /bin/true -{% endif %} + - unless: {{ test_true }} + - onlyif: {{ test_true }} unless_false_onlyif_false: file.managed: - name: {{ salt['runtests_helpers.get_salt_temp_dir_for_path']('test.txt') }} - contents: test -{% if grains['os'] == 'Windows' %} - - unless: cmd.exe /c exit 1 - - onlyif: cmd.exe /c exit 1 -{% else %} - - unless: /bin/false - - onlyif: /bin/false -{% endif %} + - unless: {{ test_false }} + - onlyif: {{ test_false }}