From d7f45a04f07c69af8a0cc959ef871589c849bd3f Mon Sep 17 00:00:00 2001 From: Tray Keller Date: Tue, 20 Feb 2024 11:25:42 -0500 Subject: [PATCH] Increasing ansible-lint to ansible-lint 6.22.1 Issue: AAH-2805 --- CHANGES/2805.misc | 1 + setup.cfg | 2 +- tests/unit/test_loader_collection.py | 40 +++++++++++----------------- 3 files changed, 18 insertions(+), 25 deletions(-) create mode 100644 CHANGES/2805.misc diff --git a/CHANGES/2805.misc b/CHANGES/2805.misc new file mode 100644 index 00000000..18b29cb0 --- /dev/null +++ b/CHANGES/2805.misc @@ -0,0 +1 @@ +Increasing ansible-lint to ansible-lint 6.22.1 diff --git a/setup.cfg b/setup.cfg index 4e80a6f7..7085d8ff 100644 --- a/setup.cfg +++ b/setup.cfg @@ -19,7 +19,7 @@ packages = find: install_requires = ansible-core ansible-builder>=1.2.0,<4.0 - ansible-lint>=6.2.2,<=6.14.3 + ansible-lint>=6.2.2,<=6.22.1 attrs>=21.4.0,<23 bleach>=3.3.0,<4 bleach-allowlist>=1.0.3,<2 diff --git a/tests/unit/test_loader_collection.py b/tests/unit/test_loader_collection.py index fc1fbbbe..1997bdc5 100644 --- a/tests/unit/test_loader_collection.py +++ b/tests/unit/test_loader_collection.py @@ -207,8 +207,8 @@ def test_manifest_success(_build_docs_blob, populated_collection_root): cfg=SimpleNamespace( run_ansible_doc=True, run_ansible_lint=False, - check_changelog=False, ansible_local_tmp=populated_collection_root, + check_changelog=True, ), ).load() assert data.metadata.namespace == "my_namespace" @@ -383,8 +383,8 @@ def test_filename_empty_value(_build_docs_blob, populated_collection_root): cfg=SimpleNamespace( run_ansible_doc=True, run_ansible_lint=False, - check_changelog=False, ansible_local_tmp=populated_collection_root, + check_changelog=True, ), ).load() assert data.metadata.namespace == "my_namespace" @@ -402,9 +402,9 @@ def test_filename_none(_build_docs_blob, populated_collection_root): filename, cfg=SimpleNamespace( run_ansible_doc=True, - check_changelog=False, run_ansible_lint=False, ansible_local_tmp=populated_collection_root, + check_changelog=True, ), ).load() assert data.metadata.namespace == "my_namespace" @@ -431,8 +431,8 @@ def test_license_file(populated_collection_root): cfg=SimpleNamespace( run_ansible_doc=True, run_ansible_lint=False, - check_changelog=False, ansible_local_tmp=populated_collection_root, + check_changelog=True, ), ).load() assert data.metadata.license_file == "LICENSE" @@ -450,14 +450,7 @@ def test_missing_readme(populated_collection_root): @pytest.mark.parametrize( - "changelog_path", - [ - "CHANGELOG.rst", - "docs/CHANGELOG.rst", - "docs/CHANGELOG.md", - "CHANGELOG.md", - "changelogs/changelog.yaml", - ], + "changelog_path", ["CHANGELOG.rst", "CHANGELOG.md", "changelogs/changelog.yaml"] ) def test_changelog(changelog_path, tmpdir, caplog): dirname = os.path.dirname(changelog_path) @@ -483,14 +476,16 @@ def test_changelog_fail(_build_docs_blob, populated_collection_root, caplog): cfg=SimpleNamespace( run_ansible_doc=True, run_ansible_lint=False, - check_changelog=True, ansible_local_tmp=populated_collection_root, + check_changelog=True, ), ).load() + log.debug("TRAY: %s", str(caplog.records[0])) + print("TRAY: %s", str(caplog.records[0])) assert ( "No changelog found. " - "Add a CHANGELOG.rst or CHANGELOG.md file in the collection root or docs/ dir, or a " - "changelogs/changelog.yaml file." in str(caplog.records[0]) + "Add a CHANGELOG.rst, CHANGELOG.md, or changelogs/changelog.yaml file." + in str(caplog.records[0]) ) @@ -566,15 +561,13 @@ def test_ansiblelint_playbook_errors(populated_collection_root, tmp_collection_r cfg=SimpleNamespace( run_ansible_doc=False, run_ansible_lint=True, - check_changelog=False, offline_ansible_lint=True, ansible_local_tmp=tmp_collection_root, ), ) collection_loader._lint_collection() shutil.rmtree(playbook_dir) - - assert "All names should start with an uppercase letter" in str(caplog.records[0]) + assert "All names should start with an uppercase letter" in str(caplog.records[1]) def test_ansiblelint_collection_pass(populated_collection_root, tmp_collection_root, caplog): @@ -590,7 +583,7 @@ def test_ansiblelint_collection_pass(populated_collection_root, tmp_collection_r ) collection_loader._lint_collection() - assert len(caplog.records) == 0 + assert len(caplog.records) == 1 def test_ansiblelint_true_loader(populated_collection_root, tmp_collection_root, caplog): @@ -600,14 +593,14 @@ def test_ansiblelint_true_loader(populated_collection_root, tmp_collection_root, cfg=SimpleNamespace( run_ansible_doc=False, run_ansible_lint=True, - check_changelog=False, offline_ansible_lint=True, ansible_local_tmp=tmp_collection_root, + check_changelog=True, ), ) collection_loader.load() - assert len(caplog.records) == 0 + assert len(caplog.records) == 2 # Changelog error expected def test_ansiblelint_collection_role_errors(populated_collection_root, tmp_collection_root, caplog): @@ -629,11 +622,10 @@ def test_ansiblelint_collection_role_errors(populated_collection_root, tmp_colle ) collection_loader._lint_collection() shutil.rmtree(task_dir) - assert "name[casing]: All names should start with an uppercase letter." in str( - caplog.records[0] + caplog.records[1] ) - assert "jinja[spacing]: Jinja2 spacing could be improved:" in str(caplog.records[1]) + assert "jinja[spacing]: Jinja2 spacing could be improved:" in str(caplog.records[2]) def test_ansiblelint_collection_meta_runtime_errors(