diff options
| author | Kate Case <kcase@redhat.com> | 2023-01-25 08:37:58 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-01-25 08:37:58 -0500 |
| commit | e9911888f6dcdf9031f3fdb2e32c52e45815fdbe (patch) | |
| tree | dc22abb4a329ef04e98685b81d074679dc24c456 /tests/integration/targets/vyos_interfaces | |
| parent | bcfe61a3b6ff69f08450f3dbd8f0f1827fb18ab3 (diff) | |
| download | vyos.vyos-e9911888f6dcdf9031f3fdb2e32c52e45815fdbe.tar.gz vyos.vyos-e9911888f6dcdf9031f3fdb2e32c52e45815fdbe.zip | |
Add prettier and isort to pre-commit. (#270)
* Add prettier and isort to pre-commit.
* Bump line-length to 100
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Diffstat (limited to 'tests/integration/targets/vyos_interfaces')
11 files changed, 33 insertions, 40 deletions
diff --git a/tests/integration/targets/vyos_interfaces/defaults/main.yaml b/tests/integration/targets/vyos_interfaces/defaults/main.yaml index 852a6bee..164afead 100644 --- a/tests/integration/targets/vyos_interfaces/defaults/main.yaml +++ b/tests/integration/targets/vyos_interfaces/defaults/main.yaml @@ -1,3 +1,3 @@ --- -testcase: '[^_].*' +testcase: "[^_].*" test_items: [] diff --git a/tests/integration/targets/vyos_interfaces/tasks/cli.yaml b/tests/integration/targets/vyos_interfaces/tasks/cli.yaml index 93eb2fe4..83496e0e 100644 --- a/tests/integration/targets/vyos_interfaces/tasks/cli.yaml +++ b/tests/integration/targets/vyos_interfaces/tasks/cli.yaml @@ -1,8 +1,8 @@ --- - name: Collect all cli test cases find: - paths: '{{ role_path }}/tests/cli' - patterns: '{{ testcase }}.yaml' + paths: "{{ role_path }}/tests/cli" + patterns: "{{ testcase }}.yaml" use_regex: true register: test_cases delegate_to: localhost @@ -11,9 +11,9 @@ set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - name: Run test case (connection=ansible.netcommon.network_cli) - include: '{{ test_case_to_run }}' + include: "{{ test_case_to_run }}" vars: ansible_connection: ansible.netcommon.network_cli - with_items: '{{ test_items }}' + with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/tests/integration/targets/vyos_interfaces/tasks/redirection.yaml b/tests/integration/targets/vyos_interfaces/tasks/redirection.yaml index 5564a3ea..48ad53ae 100644 --- a/tests/integration/targets/vyos_interfaces/tasks/redirection.yaml +++ b/tests/integration/targets/vyos_interfaces/tasks/redirection.yaml @@ -1,8 +1,8 @@ --- - name: collect all redirection cli test cases find: - paths: '{{ role_path }}/tests/redirection/cli' - patterns: '{{ testcase }}.yaml' + paths: "{{ role_path }}/tests/redirection/cli" + patterns: "{{ testcase }}.yaml" register: shortname_test_cases delegate_to: localhost @@ -10,7 +10,7 @@ set_fact: test_items="{{ shortname_test_cases.files | map(attribute='path') | list }}" - name: run test case (connection=ansible.netcommon.network_cli) - include: '{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli' - with_items: '{{ test_items }}' + include: "{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli" + with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/tests/integration/targets/vyos_interfaces/tests/cli/_populate.yaml b/tests/integration/targets/vyos_interfaces/tests/cli/_populate.yaml index 686236f2..702930c5 100644 --- a/tests/integration/targets/vyos_interfaces/tests/cli/_populate.yaml +++ b/tests/integration/targets/vyos_interfaces/tests/cli/_populate.yaml @@ -1,7 +1,8 @@ --- - name: Setup vars: - lines: "set interfaces ethernet \"{{ intf }}\" description 'Configured by Ansible'\n\ + lines: + "set interfaces ethernet \"{{ intf }}\" description 'Configured by Ansible'\n\ set interfaces ethernet \"{{ intf }}\" speed 'auto'\nset interfaces ethernet\ \ \"{{ intf }}\" duplex 'auto'\nset interfaces ethernet \"{{ intf }}\" mtu\ \ '1500'\nset interfaces ethernet \"{{ intf }}\" vif 200\nset interfaces ethernet\ @@ -12,4 +13,4 @@ loop_control: loop_var: intf ansible.netcommon.cli_config: - config: '{{ lines }}' + config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_interfaces/tests/cli/_remove_config.yaml b/tests/integration/targets/vyos_interfaces/tests/cli/_remove_config.yaml index 298cf5d7..6353d1c7 100644 --- a/tests/integration/targets/vyos_interfaces/tests/cli/_remove_config.yaml +++ b/tests/integration/targets/vyos_interfaces/tests/cli/_remove_config.yaml @@ -1,7 +1,8 @@ --- - name: Remove Config vars: - lines: "delete interfaces ethernet \"{{ intf }}\" description\ndelete interfaces\ + lines: + "delete interfaces ethernet \"{{ intf }}\" description\ndelete interfaces\ \ ethernet \"{{ intf }}\" speed\ndelete interfaces ethernet \"{{ intf }}\"\ \ duplex\ndelete interfaces ethernet \"{{ intf }}\" mtu\ndelete interfaces\ \ ethernet \"{{ intf }}\" disable\ndelete interfaces ethernet \"{{ intf }}\"\ @@ -12,4 +13,4 @@ loop_control: loop_var: intf ansible.netcommon.cli_config: - config: '{{ lines }}' + config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_interfaces/tests/cli/deleted.yaml b/tests/integration/targets/vyos_interfaces/tests/cli/deleted.yaml index 56e747a9..2c12ff2f 100644 --- a/tests/integration/targets/vyos_interfaces/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_interfaces/tests/cli/deleted.yaml @@ -1,17 +1,16 @@ --- - debug: - msg: Start vyos_interfaces deleted integration tests ansible_connection={{ ansible_connection + msg: + Start vyos_interfaces deleted integration tests ansible_connection={{ ansible_connection }} - include_tasks: _populate.yaml - block: - - name: Delete attributes of given interfaces register: result vyos.vyos.vyos_interfaces: &id001 config: - - name: eth1 - name: eth2 @@ -49,5 +48,4 @@ - "{{ deleted['after'] | symmetric_difference(result['before']) |length\ \ == 0 }}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_interfaces/tests/cli/overridden.yaml b/tests/integration/targets/vyos_interfaces/tests/cli/overridden.yaml index 9921e5dd..d4052c8a 100644 --- a/tests/integration/targets/vyos_interfaces/tests/cli/overridden.yaml +++ b/tests/integration/targets/vyos_interfaces/tests/cli/overridden.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_interfaces overridden integration tests on connection={{ ansible_connection + msg: + START vyos_interfaces overridden integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -8,12 +9,10 @@ - include_tasks: _populate.yaml - block: - - name: Overrides all device configuration with provided configuration register: result vyos.vyos.vyos_interfaces: &id001 config: - - name: eth0 speed: auto duplex: auto @@ -55,5 +54,4 @@ - "{{ overridden['after'] | symmetric_difference(result['before']) |length\ \ == 0 }}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_interfaces/tests/cli/parsed.yaml b/tests/integration/targets/vyos_interfaces/tests/cli/parsed.yaml index a44fc2f3..a22fb60f 100644 --- a/tests/integration/targets/vyos_interfaces/tests/cli/parsed.yaml +++ b/tests/integration/targets/vyos_interfaces/tests/cli/parsed.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_interfaces parsed integration tests on connection={{ ansible_connection + msg: + START vyos_interfaces parsed integration tests on connection={{ ansible_connection }} - name: Parse externally provided interfaces config to agnostic model diff --git a/tests/integration/targets/vyos_interfaces/tests/cli/rendered.yaml b/tests/integration/targets/vyos_interfaces/tests/cli/rendered.yaml index 5030d718..e8f3591a 100644 --- a/tests/integration/targets/vyos_interfaces/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_interfaces/tests/cli/rendered.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_interfaces rendered integration tests on connection={{ ansible_connection + msg: + START vyos_interfaces rendered integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -8,7 +9,6 @@ - include_tasks: _populate.yaml - block: - - name: Structure provided configuration into device specific commands register: result vyos.vyos.vyos_interfaces: @@ -43,5 +43,4 @@ - "{{ rendered['commands'] | symmetric_difference(result['rendered'])\ \ |length == 0 }}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_interfaces/tests/cli/replaced.yaml b/tests/integration/targets/vyos_interfaces/tests/cli/replaced.yaml index 8b68c5a5..daf8045f 100644 --- a/tests/integration/targets/vyos_interfaces/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_interfaces/tests/cli/replaced.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_interfaces replaced integration tests on connection={{ ansible_connection + msg: + START vyos_interfaces replaced integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -8,16 +9,13 @@ - include_tasks: _populate.yaml - block: - - name: Replace device configurations of listed interfaces with provided configurations register: result vyos.vyos.vyos_interfaces: &id001 config: - - name: eth1 description: Replaced by Ansible vifs: - - vlan_id: 100 description: VIF 100 - Replaced by Ansible @@ -43,7 +41,8 @@ - "{{ replaced['after'] | symmetric_difference(result['after']) |length\ \ == 0 }}" - - name: Replace device configurations of listed interfaces with provided configurarions + - name: + Replace device configurations of listed interfaces with provided configurarions (IDEMPOTENT) register: result vyos.vyos.vyos_interfaces: *id001 @@ -59,5 +58,4 @@ - "{{ replaced['after'] | symmetric_difference(result['before']) |length\ \ == 0 }}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_interfaces/tests/cli/rtt.yaml b/tests/integration/targets/vyos_interfaces/tests/cli/rtt.yaml index f003c0bb..5aefbb4d 100644 --- a/tests/integration/targets/vyos_interfaces/tests/cli/rtt.yaml +++ b/tests/integration/targets/vyos_interfaces/tests/cli/rtt.yaml @@ -1,17 +1,16 @@ --- - debug: - msg: START vyos_interfaces round trip integration tests on connection={{ ansible_connection + msg: + START vyos_interfaces round trip integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml - block: - - name: Apply the provided configuration (base config) register: base_config vyos.vyos.vyos_interfaces: config: - - name: eth0 enabled: true duplex: auto @@ -21,7 +20,6 @@ description: Interface - 1 mtu: 1500 vifs: - - vlan_id: 100 description: Eth1 - VIF 100 mtu: 200 @@ -46,12 +44,10 @@ register: result vyos.vyos.vyos_interfaces: config: - - name: eth1 description: Interface 1 - Description (WILL BE REVERTED) mtu: 1200 vifs: - - vlan_id: 100 description: Eth1 - VIF 100 (WILL BE REVERTED) mtu: 400 @@ -68,7 +64,8 @@ - name: Assert that changes were applied assert: - that: "{{ round_trip['after'] | symmetric_difference(result['after']) |length\ + that: + "{{ round_trip['after'] | symmetric_difference(result['after']) |length\ \ == 0 }}" - name: Revert back to base config using facts round trip @@ -79,8 +76,8 @@ - name: Assert that config was reverted assert: - that: "{{ base_config['after'] | symmetric_difference(revert['after']) |length\ + that: + "{{ base_config['after'] | symmetric_difference(revert['after']) |length\ \ == 0 }}" always: - - include_tasks: _remove_config.yaml |
