From e9911888f6dcdf9031f3fdb2e32c52e45815fdbe Mon Sep 17 00:00:00 2001 From: Kate Case Date: Wed, 25 Jan 2023 08:37:58 -0500 Subject: 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> --- .../targets/vyos_lag_interfaces/defaults/main.yaml | 2 +- .../integration/targets/vyos_lag_interfaces/tasks/cli.yaml | 8 ++++---- .../targets/vyos_lag_interfaces/tasks/redirection.yaml | 8 ++++---- .../targets/vyos_lag_interfaces/tests/cli/_add_bond.yaml | 2 +- .../targets/vyos_lag_interfaces/tests/cli/_populate.yaml | 5 +++-- .../vyos_lag_interfaces/tests/cli/_remove_bond.yaml | 2 +- .../vyos_lag_interfaces/tests/cli/_remove_config.yaml | 5 +++-- .../targets/vyos_lag_interfaces/tests/cli/deleted.yaml | 6 ++---- .../vyos_lag_interfaces/tests/cli/empty_config.yaml | 3 ++- .../targets/vyos_lag_interfaces/tests/cli/overridden.yaml | 4 ---- .../targets/vyos_lag_interfaces/tests/cli/parsed.yaml | 8 ++++---- .../targets/vyos_lag_interfaces/tests/cli/rendered.yaml | 5 ++--- .../targets/vyos_lag_interfaces/tests/cli/replaced.yaml | 7 ++----- .../targets/vyos_lag_interfaces/tests/cli/rtt.yaml | 14 ++++---------- 14 files changed, 33 insertions(+), 46 deletions(-) (limited to 'tests/integration/targets/vyos_lag_interfaces') diff --git a/tests/integration/targets/vyos_lag_interfaces/defaults/main.yaml b/tests/integration/targets/vyos_lag_interfaces/defaults/main.yaml index 852a6be..164afea 100644 --- a/tests/integration/targets/vyos_lag_interfaces/defaults/main.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/defaults/main.yaml @@ -1,3 +1,3 @@ --- -testcase: '[^_].*' +testcase: "[^_].*" test_items: [] diff --git a/tests/integration/targets/vyos_lag_interfaces/tasks/cli.yaml b/tests/integration/targets/vyos_lag_interfaces/tasks/cli.yaml index 93eb2fe..83496e0 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tasks/cli.yaml +++ b/tests/integration/targets/vyos_lag_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_lag_interfaces/tasks/redirection.yaml b/tests/integration/targets/vyos_lag_interfaces/tasks/redirection.yaml index 5564a3e..48ad53a 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tasks/redirection.yaml +++ b/tests/integration/targets/vyos_lag_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_lag_interfaces/tests/cli/_add_bond.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/cli/_add_bond.yaml index 927a6ce..00b7e6e 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/_add_bond.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/_add_bond.yaml @@ -3,4 +3,4 @@ vars: lines: "set interfaces bonding bond0\nset interfaces bonding bond1\n" ansible.netcommon.cli_config: - config: '{{ lines }}' + config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_lag_interfaces/tests/cli/_populate.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/cli/_populate.yaml index f646742..4ad0b85 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/_populate.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/_populate.yaml @@ -1,11 +1,12 @@ --- - name: Setup vars: - lines: "set interfaces bonding bond0\nset interfaces bonding bond0 hash-policy\ + lines: + "set interfaces bonding bond0\nset interfaces bonding bond0 hash-policy\ \ 'layer2'\nset interfaces bonding bond0 mode 'active-backup'\nset interfaces\ \ ethernet eth1 bond-group bond0\nset interfaces bonding bond1\nset interfaces\ \ bonding bond0 primary 'eth1'\nset interfaces bonding bond1 hash-policy 'layer2+3'\n\ set interfaces bonding bond1 mode 'active-backup'\nset interfaces ethernet\ \ eth2 bond-group bond1\nset interfaces bonding bond1 primary 'eth2'\n" ansible.netcommon.cli_config: - config: '{{ lines }}' + config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_lag_interfaces/tests/cli/_remove_bond.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/cli/_remove_bond.yaml index 6679d6a..dfc9920 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/_remove_bond.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/_remove_bond.yaml @@ -3,4 +3,4 @@ vars: lines: "delete interfaces bonding bond0\ndelete interfaces bonding bond1\n" ansible.netcommon.cli_config: - config: '{{ lines }}' + config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_lag_interfaces/tests/cli/_remove_config.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/cli/_remove_config.yaml index 5469bf5..11432ea 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/_remove_config.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/_remove_config.yaml @@ -1,10 +1,11 @@ --- - name: Remove Config vars: - lines: "delete interfaces bonding bond0 hash-policy\ndelete interfaces ethernet\ + lines: + "delete interfaces bonding bond0 hash-policy\ndelete interfaces ethernet\ \ eth1 bond-group bond0\ndelete interfaces bonding bond0 mode\ndelete interfaces\ \ bonding bond0 primary\ndelete interfaces bonding bond1 hash-policy\ndelete\ \ interfaces ethernet eth2 bond-group bond1\ndelete interfaces bonding bond1\ \ mode\ndelete interfaces bonding bond1 primary\n" ansible.netcommon.cli_config: - config: '{{ lines }}' + config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_lag_interfaces/tests/cli/deleted.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/cli/deleted.yaml index ac8204f..56f1ed6 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/deleted.yaml @@ -1,17 +1,16 @@ --- - debug: - msg: Start vyos_lag_interfaces deleted integration tests ansible_connection={{ + msg: + Start vyos_lag_interfaces deleted integration tests ansible_connection={{ ansible_connection }} - include_tasks: _populate.yaml - block: - - name: Delete attributes of given LAG interfaces. register: result vyos.vyos.vyos_lag_interfaces: &id001 config: - - name: bond0 - name: bond1 @@ -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_lag_interfaces/tests/cli/empty_config.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/cli/empty_config.yaml index 6e89eae..22ac8a8 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/empty_config.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/empty_config.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_lag_interfaces empty_config integration tests on connection={{ + msg: + START vyos_lag_interfaces empty_config integration tests on connection={{ ansible_connection }} - name: Merged with empty config should give appropriate error message diff --git a/tests/integration/targets/vyos_lag_interfaces/tests/cli/overridden.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/cli/overridden.yaml index aa6e247..9682fd7 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/overridden.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/overridden.yaml @@ -10,16 +10,13 @@ - include_tasks: _populate.yaml - block: - - name: Overrides all device configuration with provided configuration register: result vyos.vyos.vyos_lag_interfaces: &id001 config: - - name: bond1 mode: active-backup members: - - member: eth2 primary: eth2 hash_policy: layer2 @@ -57,5 +54,4 @@ - "{{ overridden['after'] | symmetric_difference(result['before']) |length\ \ == 0 }}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_lag_interfaces/tests/cli/parsed.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/cli/parsed.yaml index ed7bc61..ce2df0d 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/parsed.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/parsed.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_lag_interfaces parsed integration tests on connection={{ ansible_connection + msg: + START vyos_lag_interfaces parsed integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -8,7 +9,6 @@ - include_tasks: _populate.yaml - block: - - name: Gather lag_interfaces facts register: lag_interfaces_facts vyos.vyos.vyos_facts: @@ -25,9 +25,9 @@ - name: Assert that correct parsing done assert: - that: "{{ ansible_facts['network_resources']['lag_interfaces'] | symmetric_difference(result['parsed'])\ + that: + "{{ ansible_facts['network_resources']['lag_interfaces'] | symmetric_difference(result['parsed'])\ \ |length == 0 }}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_lag_interfaces/tests/cli/rendered.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/cli/rendered.yaml index e6d7928..781100f 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/rendered.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_lag_interfaces rendered integration tests on connection={{ ansible_connection + msg: + START vyos_lag_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_lag_interfaces: @@ -34,5 +34,4 @@ \ |length == 0 }}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_lag_interfaces/tests/cli/replaced.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/cli/replaced.yaml index c080056..c8b711b 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/replaced.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_lag_interfaces replaced integration tests on connection={{ ansible_connection + msg: + START vyos_lag_interfaces replaced integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -8,18 +9,15 @@ - include_tasks: _populate.yaml - block: - - name: Replace device configurations of listed LAG interfaces with provided configurations register: result vyos.vyos.vyos_lag_interfaces: &id001 config: - - name: bond1 mode: 802.3ad hash_policy: layer2 members: - - member: eth2 state: replaced @@ -56,5 +54,4 @@ - "{{ replaced['after'] | symmetric_difference(result['before']) |length\ \ == 0 }}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_lag_interfaces/tests/cli/rtt.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/cli/rtt.yaml index 55e2bbf..f5f6098 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/rtt.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/rtt.yaml @@ -8,17 +8,14 @@ - include_tasks: _remove_bond.yaml - block: - - name: Apply the provided configuration (base config) register: base_config vyos.vyos.vyos_lag_interfaces: config: - - name: bond0 hash_policy: layer2 mode: active-backup members: - - member: eth1 primary: eth1 @@ -26,7 +23,6 @@ hash_policy: layer2+3 mode: active-backup members: - - member: eth2 primary: eth2 state: merged @@ -42,25 +38,23 @@ register: result vyos.vyos.vyos_lag_interfaces: config: - - name: bond0 hash_policy: layer2+3 mode: 802.3ad members: - - member: eth1 - name: bond1 hash_policy: layer2 mode: xor-hash members: - - member: eth2 state: merged - 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 @@ -71,8 +65,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 -- cgit v1.2.3