diff options
Diffstat (limited to '.github')
| -rw-r--r-- | .github/copilot-instructions.md | 7 | ||||
| -rw-r--r-- | .github/instructions/modules.instructions.md | 2 | ||||
| -rw-r--r-- | .github/instructions/tests.instructions.md | 10 |
3 files changed, 14 insertions, 5 deletions
diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 02d951ce..fc25faa1 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -40,9 +40,10 @@ Resource modules support all states: `merged`, `replaced`, `overridden`, `delete ## VyOS CLI conventions -- Set commands with string/address values: `set interfaces ethernet eth0 address '192.0.2.1/24'` +- Set commands: `set interfaces ethernet eth0 address '192.0.2.1/24'` - Delete commands: `delete interfaces ethernet eth0 address '192.0.2.1/24'` -- String and address values are single-quoted; boolean flags and bare keywords are not. +- Quoting varies by context. In general, string values (descriptions, names, ELIN numbers) are single-quoted; boolean flags and bare keywords are not. However, address/prefix values may be quoted or unquoted depending on where they appear: - Quoted: `address '192.0.2.1/24'`, `description 'my-iface'`, `elin '0000000911'` - - Unquoted: `disable`, `mtu-ignore`, `set interfaces loopback lo`, `vif 200` + - Unquoted: `address 192.0.2.1` (in firewall groups), `disable`, `mtu-ignore`, `vif 200` +- When reviewing tests and fixtures, align with the quoting style used by surrounding fixtures rather than flagging a missing quote as an error. - Interface types: `ethernet`, `loopback`, `bonding`, `bridge`, `tunnel`, `wireguard`. diff --git a/.github/instructions/modules.instructions.md b/.github/instructions/modules.instructions.md index 85a34015..d7782e1e 100644 --- a/.github/instructions/modules.instructions.md +++ b/.github/instructions/modules.instructions.md @@ -34,4 +34,4 @@ Verify any changed redirect target exists as a real module file under `plugins/m ## cliconf / terminal plugins `plugins/cliconf/vyos.py` — do not modify without understanding edit-mode and commit semantics. -`plugins/terminal/vyos.py` — handles prompt detection; regex changes require testing against all supported VyOS versions (1.3.8, 1.4.1, 1.4.2, 1.5 rolling). +`plugins/terminal/vyos.py` — handles prompt detection; regex changes require testing against all supported VyOS versions listed in README.md. diff --git a/.github/instructions/tests.instructions.md b/.github/instructions/tests.instructions.md index 66f08f88..150db41e 100644 --- a/.github/instructions/tests.instructions.md +++ b/.github/instructions/tests.instructions.md @@ -20,15 +20,23 @@ class TestVyosFooModule(TestVyosModule): ## Mocking: resource modules -Resource module tests require two framework-level patches in `setUp`: +Resource module tests require two framework-level patches in `setUp` with corresponding cleanup in `tearDown`: ```python +# in setUp: self.mock_get_resource_connection_config = patch( "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base.get_resource_connection" ) +self.get_resource_connection_config = self.mock_get_resource_connection_config.start() + self.mock_get_resource_connection_facts = patch( "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.get_resource_connection" ) +self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start() + +# in tearDown: +self.mock_get_resource_connection_config.stop() +self.mock_get_resource_connection_facts.stop() ``` Most resource module tests also patch the facts class's `get_device_data` method directly and use it in `load_fixtures`: |
