Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The --syntax-check option can not test dynamically included files. #51

Open
letompouce opened this issue Nov 14, 2016 · 2 comments
Open
Labels

Comments

@letompouce
Copy link
Member

$ figlet 'py.test' >> roles/mongodb/task/mongodb_armv7l.yml
$ py.test
======================================================================================================= test session starts =======================================================================================================
platform linux2 -- Python 2.7.9, pytest-3.0.3, py-1.4.31, pluggy-0.4.0
rootdir: /home/tom/dev/ansiblecube, inifile: 
collected 61 items 

tests/test_ansible.py ....................
tests/test_syntax.py .........................................

==================================================================================================== 61 passed in 5.24 seconds ====================================================================================================
@letompouce letompouce added the bug label Nov 14, 2016
@letompouce letompouce changed the title Tests seem to not catch obvious errors. Tests can not test all included files. Nov 14, 2016
@letompouce
Copy link
Member Author

A file has an include statement, which depends on some variable:

$ head -n 3 roles/mongodb/tasks/main.yml
---
- include: mongodb_{{ ansible_architecture }}.yml

This file is not included when running ansible-playbook --syntax-check:

$ ansible-playbook main.yml --syntax-check
statically included: /home/tom/dev/ansiblecube/roles/system/tasks/ralink.yml
statically included: /home/tom/dev/ansiblecube/roles/system/tasks/realtek.yml
statically included: /home/tom/dev/ansiblecube/roles/system/tasks/lime2.yml
statically included: /home/tom/dev/ansiblecube/roles/ideascube/tasks/branding.yml
statically included: /home/tom/dev/ansiblecube/roles/ideascube/tasks/ideascube.yml
statically included: /home/tom/dev/ansiblecube/roles/ideascube/tasks/ext_hdd.yml
statically included: /home/tom/dev/ansiblecube/roles/ideascube/tasks/../../../post_install.yml
statically included: /home/tom/dev/ansiblecube/roles/kiwix/tasks/kiwix.yml
statically included: /home/tom/dev/ansiblecube/roles/kiwix/tasks/dust-removal.yml
statically included: /home/tom/dev/ansiblecube/roles/kiwix/tasks/update_catalog.yml
statically included: /home/tom/dev/ansiblecube/roles/kiwix/tasks/../../../post_install.yml
statically included: /home/tom/dev/ansiblecube/roles/mongodb/tasks/../../../post_install.yml
statically included: /home/tom/dev/ansiblecube/roles/mook/tasks/back_end.yml
statically included: /home/tom/dev/ansiblecube/roles/mook/tasks/front_end.yml
statically included: /home/tom/dev/ansiblecube/roles/mook/tasks/system.yml
statically included: /home/tom/dev/ansiblecube/roles/mook/tasks/../../../post_install.yml
statically included: /home/tom/dev/ansiblecube/roles/mook/tasks/back_end.yml
statically included: /home/tom/dev/ansiblecube/roles/mook/tasks/front_end.yml
statically included: /home/tom/dev/ansiblecube/roles/mook/tasks/system.yml
statically included: /home/tom/dev/ansiblecube/roles/mook/tasks/../../../post_install.yml
statically included: /home/tom/dev/ansiblecube/roles/appinventor/tasks/appinventor.yml
statically included: /home/tom/dev/ansiblecube/roles/appinventor/tasks/../../../post_install.yml
statically included: /home/tom/dev/ansiblecube/roles/kalite/tasks/kalite.yml
statically included: /home/tom/dev/ansiblecube/roles/kalite/tasks/ext_hdd.yml
statically included: /home/tom/dev/ansiblecube/roles/kalite/tasks/import_videos.yml
statically included: /home/tom/dev/ansiblecube/roles/kalite/tasks/../../../post_install.yml

playbook: main.yml

So many tasks files are not tested.

@letompouce
Copy link
Member Author

One of the lead devs makes it clear,

It cannot check syntax of dynamically included files, this would also affect include and include_roles. Since those would need actually executing the tasks.

@letompouce letompouce changed the title Tests can not test all included files. The --syntax-check option can not test dynamically included files. Nov 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant