Skip to content

Commit 37db3f3

Browse files
committed
Refactor eco testing
1 parent 8c9b342 commit 37db3f3

29 files changed

+893
-46
lines changed

.github/workflows/tox.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ jobs:
4141
hook
4242
docs
4343
schemas
44-
eco
4544
pre
4645
py311-devel
4746
py310-lower
@@ -110,6 +109,7 @@ jobs:
110109
with:
111110
path: |
112111
.cache/eco
112+
test/fixtures/eco/*/.tox
113113
examples/playbooks/collections/ansible_collections
114114
~/.cache/ansible-compat
115115
~/.ansible/collections

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,4 @@ node_modules
8282
.direnv
8383
uv.lock
8484
.ansible
85+
test/fixtures/eco

.gitmodules

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[submodule "test/fixtures/eco/bootstrap"]
2+
path = test/fixtures/eco/bootstrap
3+
url = https://github.com/robertdebock/ansible-role-bootstrap
4+
[submodule "test/fixtures/eco/cisco.nxos"]
5+
path = test/fixtures/eco/cisco.nxos
6+
url = https://github.com/ansible-collections/cisco.nxos
7+
[submodule "test/fixtures/eco/ansible_collection_system"]
8+
path = test/fixtures/eco/ansible_collection_system
9+
url = https://github.com/devroles/ansible_collection_system
10+
[submodule "test/fixtures/eco/ansible-docker-rootless"]
11+
path = test/fixtures/eco/ansible-docker-rootless
12+
url = https://github.com/konstruktoid/ansible-docker-rootless
13+
[submodule "test/fixtures/eco/ansible-role-hardening"]
14+
path = test/fixtures/eco/ansible-role-hardening
15+
url = https://github.com/konstruktoid/ansible-role-hardening
16+
[submodule "test/fixtures/eco/ansible-role-mysql"]
17+
path = test/fixtures/eco/ansible-role-mysql
18+
url = https://github.com/geerlingguy/ansible-role-mysql.git
19+
[submodule "test/fixtures/eco/debops"]
20+
path = test/fixtures/eco/debops
21+
url = https://github.com/debops/debops

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ exclude: >
2222
examples/playbooks/vars/empty.transformed.yml|
2323
examples/playbooks/vars/empty.yml|
2424
src/ansiblelint/schemas/rulebook.json|
25+
test/fixtures/eco/.*|
2526
test/schemas/data/licenses.json|
2627
test/schemas/negative_test|
2728
test/schemas/package-lock.json

codecov.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
comment: false
33
coverage:
44
status:
5-
patch: true
5+
patch: false # avoid false positives
66
project:
7-
default:
8-
threshold: 0.5%
7+
default: true

cspell.config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ ignorePaths:
1919
- docs/requirements.in
2020
# Test fixtures generated from outside
2121
- test/**/*.result
22+
- test/fixtures/eco/**
2223
- src/ansiblelint/schemas/*.json
2324
# Other
2425
- "*.svg"

pyproject.toml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ repository = "https://github.com/ansible/ansible-lint"
5151
[tool.codespell]
5252
# indention is a typo in ruamel.yaml's API
5353
ignore-words-list = "indention"
54-
skip = ".tox,.mypy_cache,build,.git,.eggs,pip-wheel-metadata"
54+
skip = ".tox,.mypy_cache,build,.git,.eggs,pip-wheel-metadata,test/fixtures/eco/*.json"
5555

5656
# Keep this default because xml/report do not know to use load it from config file:
5757
# data_file = ".coverage"
@@ -86,7 +86,7 @@ disallow_untyped_calls = true
8686
disallow_untyped_defs = true
8787
error_summary = true
8888
# site-packages is here to help vscode mypy integration getting confused
89-
exclude = "(.cache|.config|.eggs|.tox|_readthedocs|build|dist|test/local-content|site|site-packages|~/.pyenv|examples|plugins/modules).*"
89+
exclude = "(.cache|.config|.eggs|.tox|_readthedocs|build|dist|test/local-content|site|site-packages|~/.pyenv|examples|plugins/modules|test/fixtures/eco).*"
9090
# https://github.com/python/mypy/issues/12664
9191
follow_untyped_imports = true
9292
incremental = false
@@ -392,7 +392,7 @@ reportPrivateImportUsage = false
392392
[tool.pytest.ini_options]
393393
# do not add options here as this will likely break either console runs or IDE
394394
# integration like vscode or pycharm
395-
addopts = "-p no:pytest_cov --durations=10 --failed-first"
395+
addopts = "-p no:pytest_cov --durations=10 --failed-first -m 'not eco'"
396396
doctest_optionflags = ["ALLOW_UNICODE", "ELLIPSIS"]
397397
filterwarnings = [
398398
"error",
@@ -409,6 +409,9 @@ filterwarnings = [
409409
"ignore:Attribute s is deprecated and will be removed in Python 3.14; use value instead:DeprecationWarning"
410410
]
411411
junit_family = "legacy"
412+
markers = [
413+
"eco: test impact on ecosystem repositories (slow)"
414+
]
412415
minversion = "4.6.6"
413416
# https://code.visualstudio.com/docs/python/testing
414417
# coverage is re-enabled in `tox.ini`. That approach is safer than
@@ -435,6 +438,7 @@ norecursedirs = [
435438
"plugins",
436439
"site",
437440
"src/ansible_lint.egg-info",
441+
"test/fixtures/eco",
438442
"test/schemas"
439443
]
440444
python_files = [
@@ -574,6 +578,7 @@ exclude = [
574578
"collections",
575579
"examples",
576580
"plugins",
581+
"test/fixtures/eco",
577582
"test/local-content",
578583
"venv",
579584
"src/ansiblelint/_version.py"

test/fixtures/eco/ansible-docker-rootless.json

Whitespace-only changes.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# This file contains ignores rule violations for ansible-lint
2+
molecule/default/verify.yml name[unique]
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
name[unique]: Task name 'Get PAM version' is not unique. It was first used on line 622.
2+
molecule/default/verify.yml:1124
3+

test/fixtures/eco/ansible-role-mysql

Submodule ansible-role-mysql added at d1e9210
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# This file contains ignores rule violations for ansible-lint
2+
handlers/main.yml name[casing]
3+
meta/main.yml schema[meta]
4+
tasks/databases.yml fqcn[action]
5+
tasks/main.yml name[missing]
6+
tasks/replication.yml fqcn[action]
7+
tasks/replication.yml ignore-errors
8+
tasks/secure-installation.yml fqcn[action]
9+
tasks/secure-installation.yml jinja[spacing]
10+
tasks/secure-installation.yml no-changed-when
11+
tasks/setup-RedHat.yml fqcn[action-core]
12+
tasks/users.yml fqcn[action]
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name[casing]: All names should start with an uppercase letter.
2+
handlers/main.yml:2:9 Task/Handler: restart mysql
3+
4+
schema[meta]: $.galaxy_info.min_ansible_version 2.12 is not of type 'string'. See https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_reuse_roles.html#using-role-dependencies
5+
meta/main.yml:1 Returned errors will not include exact line numbers, but they will mention
6+
the schema name being used as a tag, like ``schema[playbook]``,
7+
``schema[tasks]``.
8+
9+
This rule is not skippable and stops further processing of the file.
10+
11+
If incorrect schema was picked, you might want to either:
12+
13+
* move the file to standard location, so its file is detected correctly.
14+
* use ``kinds:`` option in linter config to help it pick correct file type.
15+
[/]
16+
17+
fqcn[action]: Use FQCN for module actions, such `community.mysql.mysql_db`.
18+
tasks/databases.yml:3:3 Action `mysql_db` is not FQCN.
19+
20+
name[missing]: All tasks should be named.
21+
tasks/main.yml:3 Task/Handler: include_tasks variables.yml
22+
23+
name[missing]: All tasks should be named.
24+
tasks/main.yml:6 Task/Handler: include_tasks setup-RedHat.yml
25+
26+
name[missing]: All tasks should be named.
27+
tasks/main.yml:9 Task/Handler: include_tasks setup-Debian.yml
28+
29+
name[missing]: All tasks should be named.
30+
tasks/main.yml:12 Task/Handler: include_tasks setup-Archlinux.yml
31+
32+
name[missing]: All tasks should be named.
33+
tasks/main.yml:22 Task/Handler: include_tasks configure.yml
34+
35+
name[missing]: All tasks should be named.
36+
tasks/main.yml:23 Task/Handler: include_tasks secure-installation.yml
37+
38+
name[missing]: All tasks should be named.
39+
tasks/main.yml:24 Task/Handler: include_tasks databases.yml
40+
41+
name[missing]: All tasks should be named.
42+
tasks/main.yml:25 Task/Handler: include_tasks users.yml
43+
44+
name[missing]: All tasks should be named.
45+
tasks/main.yml:26 Task/Handler: include_tasks replication.yml
46+
47+
fqcn[action]: Use FQCN for module actions, such `community.mysql.mysql_user`.
48+
tasks/replication.yml:3:3 Action `mysql_user` is not FQCN.
49+
50+
fqcn[action]: Use FQCN for module actions, such `community.mysql.mysql_replication`.
51+
tasks/replication.yml:18:3 Action `mysql_replication` is not FQCN.
52+
53+
fqcn[action]: Use FQCN for module actions, such `community.mysql.mysql_replication`.
54+
tasks/replication.yml:32:3 Action `mysql_replication` is not FQCN.
55+
56+
ignore-errors: Use failed_when and specify error conditions instead of using ignore_errors.
57+
tasks/replication.yml:45 Task/Handler: Configure replication on the slave.
58+
59+
fqcn[action]: Use FQCN for module actions, such `community.mysql.mysql_replication`.
60+
tasks/replication.yml:46:3 Action `mysql_replication` is not FQCN.
61+
62+
fqcn[action]: Use FQCN for module actions, such `community.mysql.mysql_replication`.
63+
tasks/replication.yml:65:3 Action `mysql_replication` is not FQCN.
64+
65+
fqcn[action]: Use FQCN for module actions, such `community.mysql.mysql_user`.
66+
tasks/secure-installation.yml:3:3 Action `mysql_user` is not FQCN.
67+
68+
jinja[spacing]: Jinja2 spacing could be improved: {{ mysql_root_hosts.stdout_lines|default([]) }} -> {{ mysql_root_hosts.stdout_lines | default([]) }} (warning)
69+
tasks/secure-installation.yml:45 Jinja2 template rewrite recommendation: `{{ mysql_root_hosts.stdout_lines | default([]) }}`.
70+
71+
no-changed-when: Commands should not change things if nothing needs doing.
72+
tasks/secure-installation.yml:45 Task/Handler: Update MySQL root authentication via socket for localhost (Linux, MySQL ≥ 8.4)
73+
74+
jinja[spacing]: Jinja2 spacing could be improved: {{ mysql_root_hosts.stdout_lines|default([]) }} -> {{ mysql_root_hosts.stdout_lines | default([]) }} (warning)
75+
tasks/secure-installation.yml:61 Jinja2 template rewrite recommendation: `{{ mysql_root_hosts.stdout_lines | default([]) }}`.
76+
77+
no-changed-when: Commands should not change things if nothing needs doing.
78+
tasks/secure-installation.yml:61 Task/Handler: Update MySQL root password for localhost root account (5.7.x ≤ MySQL < 8.4)
79+
80+
jinja[spacing]: Jinja2 spacing could be improved: {{ mysql_root_hosts.stdout_lines|default([]) }} -> {{ mysql_root_hosts.stdout_lines | default([]) }} (warning)
81+
tasks/secure-installation.yml:80 Jinja2 template rewrite recommendation: `{{ mysql_root_hosts.stdout_lines | default([]) }}`.
82+
83+
no-changed-when: Commands should not change things if nothing needs doing.
84+
tasks/secure-installation.yml:80 Task/Handler: Update MySQL root password for localhost root account (< 5.7.x).
85+
86+
jinja[spacing]: Jinja2 spacing could be improved: {{ mysql_anonymous_hosts.stdout_lines|default([]) }} -> {{ mysql_anonymous_hosts.stdout_lines | default([]) }} (warning)
87+
tasks/secure-installation.yml:110 Jinja2 template rewrite recommendation: `{{ mysql_anonymous_hosts.stdout_lines | default([]) }}`.
88+
89+
fqcn[action]: Use FQCN for module actions, such `community.mysql.mysql_user`.
90+
tasks/secure-installation.yml:111:3 Action `mysql_user` is not FQCN.
91+
92+
fqcn[action]: Use FQCN for module actions, such `community.mysql.mysql_db`.
93+
tasks/secure-installation.yml:118:3 Action `mysql_db` is not FQCN.
94+
95+
fqcn[action-core]: Use FQCN for builtin module actions (ansible.builtin.yum).
96+
tasks/setup-RedHat.yml:3:3 Use `ansible.builtin.dnf` or `ansible.legacy.dnf` instead.
97+
98+
fqcn[action]: Use FQCN for module actions, such `community.mysql.mysql_user`.
99+
tasks/users.yml:3:3 Action `mysql_user` is not FQCN.
100+
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# This file contains ignores rule violations for ansible-lint
2+
.ansible/collections/ansible_collections/devroles/system/roles/authorized_key/defaults/main.yml var-naming[no-role-prefix]
3+
.ansible/collections/ansible_collections/devroles/system/roles/dotfiles/tasks/03_vim.yml yaml[octal-values]
4+
.ansible/collections/ansible_collections/devroles/system/roles/firewalld/defaults/main.yml yaml[comments]
5+
.ansible/collections/ansible_collections/devroles/system/roles/mariadb/tasks/configure_access.yml yaml[octal-values]
6+
.ansible/collections/ansible_collections/devroles/system/roles/mounts/defaults/main.yml var-naming[no-role-prefix]
7+
.ansible/collections/ansible_collections/devroles/system/roles/mythtv/handlers/main.yml no-changed-when
8+
.ansible/collections/ansible_collections/devroles/system/roles/mythtv/tasks/main.yml yaml[octal-values]
9+
.ansible/collections/ansible_collections/devroles/system/roles/sudoers/defaults/main.yml var-naming[no-role-prefix]
10+
.ansible/collections/ansible_collections/devroles/system/roles/sudoers/tasks/main.yml yaml[octal-values]
11+
.ansible/collections/ansible_collections/devroles/system/roles/update_ca_trust/handlers/main.yml no-changed-when
12+
.ansible/collections/ansible_collections/devroles/system/roles/update_ca_trust/tasks/main.yml yaml[octal-values]
13+
.ansible/collections/ansible_collections/devroles/system/roles/webserver/defaults/main.yml var-naming[no-role-prefix]
14+
.ansible/collections/ansible_collections/devroles/system/roles/webserver/tasks/letsencrypt.yml args[module]
15+
galaxy.yml galaxy[no-changelog]
16+
galaxy.yml galaxy[tags]
17+
meta/runtime.yml meta-runtime[unsupported-version]
18+
playbooks/molecule/dotfiles/prepare.yml fqcn[action-core]
19+
playbooks/molecule/dotfiles/prepare.yml name[play]
20+
playbooks/molecule/sudo/molecule.yml yaml[line-length]
21+
roles/authorized_key/defaults/main.yml var-naming[no-role-prefix]
22+
roles/authorized_key/molecule/shared/playbook.yml name[casing]
23+
roles/authorized_key/molecule/shared/playbook.yml var-naming[no-role-prefix]
24+
roles/common/molecule/shared/playbook.yml name[casing]
25+
roles/container/molecule/shared/playbook.yml name[casing]
26+
roles/copy_or_link/molecule/default/playbook.yml name[casing]
27+
roles/copy_or_link/molecule/default/prepare.yml fqcn[action-core]
28+
roles/copy_or_link/molecule/default/prepare.yml name[casing]
29+
roles/copy_or_link/molecule/default/prepare.yml name[play]
30+
roles/copy_or_link/molecule/default/prepare.yml yaml[octal-values]
31+
roles/copy_or_link/molecule/local/playbook.yml fqcn[action-core]
32+
roles/copy_or_link/molecule/local/playbook.yml name[casing]
33+
roles/copy_or_link/molecule/local/prepare.yml fqcn[action-core]
34+
roles/copy_or_link/molecule/local/prepare.yml fqcn[action]
35+
roles/copy_or_link/molecule/local/prepare.yml name[casing]
36+
roles/copy_or_link/molecule/local/prepare.yml name[play]
37+
roles/copy_or_link/molecule/local/prepare.yml yaml[octal-values]
38+
roles/copy_or_link/molecule/local/remote_playbook.yml name[play]
39+
roles/dev/molecule/shared/playbook.yml name[casing]
40+
roles/dev/molecule/shared/prepare.yml name[casing]
41+
roles/dotfiles/molecule/shared/playbook.yml fqcn[action-core]
42+
roles/dotfiles/molecule/shared/playbook.yml name[casing]
43+
roles/dotfiles/tasks/03_vim.yml yaml[octal-values]
44+
roles/epel/molecule/shared/playbook.yml name[casing]
45+
roles/firewalld/defaults/main.yml yaml[comments]
46+
roles/firewalld/molecule/shared/playbook.yml name[casing]
47+
roles/flatpak/molecule/shared/playbook.yml fqcn[action-core]
48+
roles/mariadb/molecule/shared/playbook.yml fqcn[action-core]
49+
roles/mariadb/molecule/shared/playbook.yml name[casing]
50+
roles/mariadb/tasks/configure_access.yml yaml[octal-values]
51+
roles/mirror/molecule/shared/playbook.yml fqcn[action-core]
52+
roles/mirror/molecule/shared/playbook.yml name[casing]
53+
roles/mirror/molecule/shared/playbook.yml name[play]
54+
roles/mounts/defaults/main.yml var-naming[no-role-prefix]
55+
roles/mta/tasks/main.yml syntax-check[specific]
56+
roles/mythtv/handlers/main.yml no-changed-when
57+
roles/mythtv/tasks/main.yml yaml[octal-values]
58+
roles/packages_server/molecule/shared/playbook.yml name[casing]
59+
roles/packages_workstation/tasks/Linux/03_libvirt.yml yaml[octal-values]
60+
roles/packages_workstation/tasks/Linux/05_kerberos.yml yaml[octal-values]
61+
roles/packages_workstation/tasks/Linux/06_blu_ray.yml yaml[octal-values]
62+
roles/packages_workstation/vars/MacOSX.yml var-naming[no-role-prefix]
63+
roles/python_prep/molecule/shared/playbook.yml fqcn[action-core]
64+
roles/python_prep/molecule/shared/playbook.yml name[casing]
65+
roles/sudoers/defaults/main.yml var-naming[no-role-prefix]
66+
roles/sudoers/molecule/shared/playbook.yml name[casing]
67+
roles/sudoers/molecule/shared/prepare.yml fqcn[action-core]
68+
roles/sudoers/molecule/shared/prepare.yml name[casing]
69+
roles/sudoers/tasks/main.yml yaml[octal-values]
70+
roles/system_repositories/molecule/container/playbook.yml fqcn[action-core]
71+
roles/system_repositories/molecule/container/playbook.yml name[casing]
72+
roles/system_repositories/molecule/container_fedora/playbook.yml fqcn[action-core]
73+
roles/system_repositories/molecule/container_fedora/playbook.yml name[casing]
74+
roles/update_ca_trust/handlers/main.yml no-changed-when
75+
roles/update_ca_trust/molecule/shared/playbook.yml name[casing]
76+
roles/update_ca_trust/molecule/shared/prepare.yml fqcn[action-core]
77+
roles/update_ca_trust/molecule/shared/prepare.yml name[casing]
78+
roles/update_ca_trust/molecule/shared/prepare.yml yaml[octal-values]
79+
roles/update_ca_trust/tasks/main.yml yaml[octal-values]
80+
roles/webserver/defaults/main.yml var-naming[no-role-prefix]
81+
roles/webserver/tasks/letsencrypt.yml args[module]

0 commit comments

Comments
 (0)