From dac4b610c8a0dd67fad408649d855b8384017ddd Mon Sep 17 00:00:00 2001 From: Kate Case Date: Tue, 7 Feb 2023 13:11:59 -0500 Subject: [command] run at least once when retries is 0 (#292) * [command] run at least once when retries is 0 * [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> --- tests/unit/modules/network/vyos/test_vyos_command.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'tests/unit/modules/network') diff --git a/tests/unit/modules/network/vyos/test_vyos_command.py b/tests/unit/modules/network/vyos/test_vyos_command.py index 7ed049be..e03ea7db 100644 --- a/tests/unit/modules/network/vyos/test_vyos_command.py +++ b/tests/unit/modules/network/vyos/test_vyos_command.py @@ -85,7 +85,13 @@ class TestVyosCommandModule(TestVyosModule): wait_for = 'result[0] contains "test string"' set_module_args(dict(commands=["show version"], wait_for=wait_for, retries=2)) self.execute_module(failed=True) - self.assertEqual(self.run_commands.call_count, 2) + self.assertEqual(self.run_commands.call_count, 3) + + def test_vyos_command_no_retries(self): + wait_for = 'result[0] contains "test string"' + set_module_args(dict(commands=["show version"], wait_for=wait_for, retries=0)) + self.execute_module(failed=True) + self.assertEqual(self.run_commands.call_count, 1) def test_vyos_command_match_any(self): wait_for = [ -- cgit v1.2.3