diff options
author | Abhijeet Kasurde <akasurde@redhat.com> | 2024-12-03 16:06:29 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-03 16:06:29 +0100 |
commit | 92cf41aa467a3e57f34983f049e39c2de1ccdd3b (patch) | |
tree | aad8f3ab0a7ec28e3169c0f04929312dc1dd6219 | |
parent | Removed deprecated include_delegate_to param (#84306) (diff) | |
download | ansible-92cf41aa467a3e57f34983f049e39c2de1ccdd3b.tar.xz ansible-92cf41aa467a3e57f34983f049e39c2de1ccdd3b.zip |
Additional tests for lookup_sequence (#84315)
* Additional tests for lookup_sequence
* Follow up for https://github.com/ansible/ansible/pull/83758,
to add tests for stride parameter.
---------
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
-rw-r--r-- | test/integration/targets/lookup_sequence/tasks/main.yml | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/integration/targets/lookup_sequence/tasks/main.yml b/test/integration/targets/lookup_sequence/tasks/main.yml index e640d42b4c..5090ae92bb 100644 --- a/test/integration/targets/lookup_sequence/tasks/main.yml +++ b/test/integration/targets/lookup_sequence/tasks/main.yml @@ -1,3 +1,6 @@ +# Copyright: Contributors to the Ansible project +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + - name: test with_sequence set_fact: "{{ 'x' + item }}={{ item }}" with_sequence: start=0 end=3 @@ -216,6 +219,16 @@ that: - query("ansible.builtin.sequence", "count=5 start=0", "count=5 start=20", stride=2) == ["0", "2", "4", "6", "8", "20", "22", "24", "26", "28"] +- name: Test stride=0 produces an empty list + assert: + that: + - query("ansible.builtin.sequence", "count=5 start=0", stride=0) == [] + +- name: Test stride=-1 produces an list of negative numbers + assert: + that: + - query("ansible.builtin.sequence", "count=5 start=0", stride=-1) == ["0", "-1", "-2", "-3", "-4", "-5", "-6"] + - name: Test that keyword arguments do not overwrite parameters present in positional expressions assert: that: |