Skip to content

Commit

Permalink
Add key-order test for multiple plays
Browse files Browse the repository at this point in the history
  • Loading branch information
Qalthos committed Apr 22, 2024
1 parent 16dec2e commit 8f4d558
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
20 changes: 20 additions & 0 deletions examples/playbooks/transform-key-order-block.transformed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
- name: Testing multiple plays in a playbook
hosts: localhost
tasks:
- name: First block
when: true
block:
- name: Display a message
ansible.builtin.debug:
msg: Hello world!

- name: A second play
hosts: localhost
tasks:
- name: Second block
when: true # <-- name key should be the second one
block:
- name: Display a message
ansible.builtin.debug:
msg: Hello world!
20 changes: 20 additions & 0 deletions examples/playbooks/transform-key-order-block.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
- name: Testing multiple plays in a playbook
hosts: localhost
tasks:
- name: First block
when: true
block:
- name: Display a message
ansible.builtin.debug:
msg: Hello world!

- name: A second play
hosts: localhost
tasks:
- name: Second block
block:
- name: Display a message
ansible.builtin.debug:
msg: Hello world!
when: true # <-- name key should be the second one
7 changes: 7 additions & 0 deletions test/test_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,13 @@ def fixture_runner_result(
True,
id="key_order_play_transform",
),
pytest.param(
"examples/playbooks/transform-key-order-block.yml",
1,
True,
True,
id="key_order_block_transform",
),
pytest.param(
"examples/.github/workflows/sample.yml",
0,
Expand Down

0 comments on commit 8f4d558

Please sign in to comment.