Page MenuHomeVyOS Platform

Multi-line asserts for integration testing in vyos_firewall_rules
Closed, ResolvedPublic

Description

The integration tests for new feature, introduced by https://github.com/vyos/vyos.vyos/pull/407, is failing due to JInja2

TASK [vyos_firewall_rules : Assert - Diff for a single rule and attribute] *****
[WARNING]: Jinja constant strings should not contain embedded templates. This feature will be disabled by default in ansible-core 2.23.
Origin: /home/d368409/work/work12.vyos/lab/ansible/collections/ansible_collections/vyos/vyos/tests/output/.tmp/integration/vyos_firewall_rules-i6tabtlx-ÅÑŚÌβŁÈ/tests/integration/targets/vyos_firewall_rules/tests/cli/diff_mode.yaml:33:13
31         that:
32           - result['changed'] == true
33           - result.diff.prepared == "{{ replaced_diff_01.diff.rstrip() }}"
               ^ column 13
Use inline expressions, for example: when: "{{ a_var }}" == 42 becomes when: a_var == 42
[ERROR]: Task failed: Action failed: Assertion failed
Origin: /home/d368409/work/work12.vyos/lab/ansible/collections/ansible_collections/vyos/vyos/tests/output/.tmp/integration/vyos_firewall_rules-i6tabtlx-ÅÑŚÌβŁÈ/tests/integration/targets/vyos_firewall_rules/tests/cli/diff_mode.yaml:29:7
27         state: replaced
28
29     - name: Assert - Diff for a single rule and attribute
         ^ column 7
fatal: [target150]: FAILED! => {
    "assertion": "result.diff.prepared == \"{{ replaced_diff_01.diff.rstrip() }}\"",
    "changed": false,
    "evaluated_to": false,
    "msg": "Assertion failed"

Multi-line parsing is broken.
This task fixes the test

Details

Version
-
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Bug (incorrect behavior)