diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index 4335392d499..bcfaa1f0eff 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -59,7 +59,7 @@ jobs: WSLENV: FORCE_COLOR:PYTEST_REQPASS:TOXENV:GITHUB_STEP_SUMMARY # Number of expected test passes, safety measure for accidental skip of # tests. Update value if you add/remove tests. - PYTEST_REQPASS: 803 + PYTEST_REQPASS: 804 steps: - name: Activate WSL1 if: "contains(matrix.shell, 'wsl')" diff --git a/examples/playbooks/rule-schema-become-method-fail.yml b/examples/playbooks/rule-schema-become-method-fail.yml new file mode 100644 index 00000000000..555e14e12ce --- /dev/null +++ b/examples/playbooks/rule-schema-become-method-fail.yml @@ -0,0 +1,10 @@ +--- +- name: Test 'become_method' plugin validity + hosts: localhost + become: true + become_method: this_is_not_an_installed_plugin + tasks: + - name: Another example + ansible.builtin.debug: + msg: "This should not be reached" + become_method: this_is_not_an_installed_plugin diff --git a/examples/playbooks/rule-schema-become-method.yml b/examples/playbooks/rule-schema-become-method-pass.yml similarity index 100% rename from examples/playbooks/rule-schema-become-method.yml rename to examples/playbooks/rule-schema-become-method-pass.yml diff --git a/src/ansiblelint/rules/schema.py b/src/ansiblelint/rules/schema.py index 20a735b6f96..13673d3c0ac 100644 --- a/src/ansiblelint/rules/schema.py +++ b/src/ansiblelint/rules/schema.py @@ -299,11 +299,20 @@ def matchyaml(self, file: Lintable) -> list[MatchError]: id="rulebook2", ), pytest.param( - "examples/playbooks/rule-schema-become-method.yml", + "examples/playbooks/rule-schema-become-method-pass.yml", "playbook", [], id="playbook", ), + pytest.param( + "examples/playbooks/rule-schema-become-method-fail.yml", + "playbook", + [ + "'become_method' must be one of the currently installed plugins", + "'become_method' must be one of the currently installed plugins", + ], + id="playbook2", + ), ), ) def test_schema(file: str, expected_kind: str, expected: list[str]) -> None: