mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
added tests
refactored task selection into method list-tasks now uses common method of task selection always is now skippable if specified in --skip-tags
This commit is contained in:
parent
6fbbf9c118
commit
65c08d1364
4 changed files with 81 additions and 67 deletions
|
@ -21,7 +21,7 @@ VAULT_PASSWORD_FILE = vault-password
|
|||
|
||||
CONSUL_RUNNING := $(shell python consul_running.py)
|
||||
|
||||
all: parsing test_var_precedence unicode non_destructive destructive includes check_mode test_hash test_handlers test_group_by test_vault
|
||||
all: parsing test_var_precedence unicode non_destructive destructive includes check_mode test_hash test_handlers test_group_by test_vault test_tags
|
||||
|
||||
parsing:
|
||||
ansible-playbook bad_parsing.yml -i $(INVENTORY) -e @$(VARS_FILE) $(CREDENTIALS_ARG) -vvv $(TEST_FLAGS) --tags prepare,common,scenario1; [ $$? -eq 3 ]
|
||||
|
@ -82,6 +82,15 @@ test_delegate_to:
|
|||
test_winrm:
|
||||
ansible-playbook test_winrm.yml -i inventory.winrm -e @$(VARS_FILE) $(CREDENTIALS_ARG) -v $(TEST_FLAGS)
|
||||
|
||||
test_tags:
|
||||
# Run everything by default
|
||||
[ "$$(ansible-playbook --list-tasks test_tags.yml -i $(INVENTORY) -e @$(VARS_FILE) $(CREDENTIALS_ARG) -v $(TEST_FLAGS) | fgrep Task_with | xargs)" = "Task_with_tag Task_with_always_tag Task_without_tag" ]
|
||||
# Run the exact tags, and always
|
||||
[ "$$(ansible-playbook --list-tasks --tags tag test_tags.yml -i $(INVENTORY) -e @$(VARS_FILE) $(CREDENTIALS_ARG) -v $(TEST_FLAGS) | fgrep Task_with | xargs)" = "Task_with_tag Task_with_always_tag" ]
|
||||
# Skip one tag
|
||||
[ "$$(ansible-playbook --list-tasks --skip-tags tag test_tags.yml -i $(INVENTORY) -e @$(VARS_FILE) $(CREDENTIALS_ARG) -v $(TEST_FLAGS) | fgrep Task_with | xargs)" = "Task_with_always_tag Task_without_tag" ]
|
||||
|
||||
|
||||
cloud: amazon rackspace
|
||||
|
||||
cloud_cleanup: amazon_cleanup rackspace_cleanup
|
||||
|
|
15
test/integration/test_tags.yml
Normal file
15
test/integration/test_tags.yml
Normal file
|
@ -0,0 +1,15 @@
|
|||
---
|
||||
- name: verify tags work as expected
|
||||
hosts: localhost
|
||||
gather_facts: False
|
||||
connection: local
|
||||
tasks:
|
||||
- name: Task_with_tag
|
||||
debug: msg=
|
||||
tags: tag
|
||||
- name: Task_with_always_tag
|
||||
debug: msg=
|
||||
tags: always
|
||||
- name: Task_without_tag
|
||||
debug: msg=
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue