From 007970f9352dad1661df5ce8720fa62aaaab8018 Mon Sep 17 00:00:00 2001 From: Imran Iqbal Date: Thu, 17 Oct 2019 19:44:50 +0100 Subject: [PATCH] test(saltcheck): add support for `random` values --- cron/saltcheck-tests/config.tst | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cron/saltcheck-tests/config.tst b/cron/saltcheck-tests/config.tst index fe3646e..d928e9d 100644 --- a/cron/saltcheck-tests/config.tst +++ b/cron/saltcheck-tests/config.tst @@ -27,14 +27,20 @@ validate_cron.{{ task }}_exists: {#- Note: `special` is `spec` in the module #} {%- for section in ['minute', 'hour', 'daymonth', 'month', 'dayweek', 'comment', 'spec'] %} {%- if section in task_options %} +{%- set assertion = 'assertEqual' %} +{%- set expected = task_options.get(section) %} +{%- if expected == 'random' %} +{%- set assertion = 'assertLessEqual' %} +{%- set expected = 0 %} +{%- endif %} validate_cron.{{ task }}_{{ section }}: module_and_function: cron.get_entry args: - {{ task_options.user|d('root') }} - {{ task }} - assertion: assertEqual + assertion: {{ assertion }} assertion_section: {{ section }} - expected-return: '{{ task_options.get(section) }}' + expected-return: '{{ expected }}' {%- endif %} {%- endfor %}