summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBrian Coca <brian.coca+git@gmail.com>2015-02-12 20:58:30 -0500
committerBrian Coca <brian.coca+git@gmail.com>2015-02-13 08:27:07 -0500
commit65c08d1364dd97e784f8a853dda10fbf41542399 (patch)
tree93444a34dec941f2eb0eb314d401a4f8ef8d63a5 /test
parent6fbbf9c118a9309a29060ca6711abc1eda001f8d (diff)
downloadansible-65c08d1364dd97e784f8a853dda10fbf41542399.tar.gz
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
Diffstat (limited to 'test')
-rw-r--r--test/integration/Makefile11
-rw-r--r--test/integration/test_tags.yml15
2 files changed, 25 insertions, 1 deletions
diff --git a/test/integration/Makefile b/test/integration/Makefile
index c708e08e40..c533e06b15 100644
--- a/test/integration/Makefile
+++ b/test/integration/Makefile
@@ -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
diff --git a/test/integration/test_tags.yml b/test/integration/test_tags.yml
new file mode 100644
index 0000000000..650c4725ae
--- /dev/null
+++ b/test/integration/test_tags.yml
@@ -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=
+