From 9f514ddd1d40d071aa1ae221f6638ea0f3f20f99 Mon Sep 17 00:00:00 2001 From: James Tanner Date: Thu, 20 Feb 2014 11:20:11 -0500 Subject: [PATCH] Add mercurial test --- tests_new/integration/non_destructive.yml | 1 + .../integration/roles/test_hg/meta/main.yml | 3 + .../integration/roles/test_hg/tasks/main.yml | 80 +++++++++++++++++++ 3 files changed, 84 insertions(+) create mode 100644 tests_new/integration/roles/test_hg/meta/main.yml create mode 100644 tests_new/integration/roles/test_hg/tasks/main.yml diff --git a/tests_new/integration/non_destructive.yml b/tests_new/integration/non_destructive.yml index f09dd28967d..8c5fb2d7e41 100644 --- a/tests_new/integration/non_destructive.yml +++ b/tests_new/integration/non_destructive.yml @@ -9,4 +9,5 @@ - { role: test_synchronize, tags: test_synchronize } - { role: test_subversion, tags: test_subversion } - { role: test_git, tags: test_git } + - { role: test_hg, tags: test_hg } diff --git a/tests_new/integration/roles/test_hg/meta/main.yml b/tests_new/integration/roles/test_hg/meta/main.yml new file mode 100644 index 00000000000..1050c23ce30 --- /dev/null +++ b/tests_new/integration/roles/test_hg/meta/main.yml @@ -0,0 +1,3 @@ +dependencies: + - prepare_tests + diff --git a/tests_new/integration/roles/test_hg/tasks/main.yml b/tests_new/integration/roles/test_hg/tasks/main.yml new file mode 100644 index 00000000000..599ddc726d6 --- /dev/null +++ b/tests_new/integration/roles/test_hg/tasks/main.yml @@ -0,0 +1,80 @@ +# test code for the git module +# (c) 2014, James Tanner + +# This file is part of Ansible +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see . + +- name: set where to extract the repo + set_fact: checkout_dir={{ output_dir }}/epdb + +- name: set what repo to use + set_fact: repo=https://bitbucket.org/rpathsync/epdb + +- name: clean out the output_dir + shell: rm -rf {{ output_dir }}/* + +- name: verify that mercurial is installed so this test can continue + shell: which hg + +- name: initial checkout + hg: repo={{ repo }} dest={{ checkout_dir }} + register: hg_result + +- debug: var=hg_result + +#- shell: ls ~/ansible_testing/epdb +- shell: ls {{ checkout_dir }} + +- name: verify information about the initial clone + assert: + that: + - "'before' in hg_result" + - "'after' in hg_result" + - "not hg_result.before" + - "hg_result.changed" + +- name: repeated checkout + hg: repo={{ repo }} dest={{ checkout_dir }} + register: hg_result2 + +- debug: var=hg_result2 + +- name: check for tags + stat: path={{ checkout_dir }}/.hgtags + register: tags + +- name: check for HEAD + stat: path={{ checkout_dir }}/.hg/cache/branchheads + register: head + +- name: check for remotes + stat: path={{ checkout_dir }}/.hg/branch + register: branches + +- name: assert presense of tags/trunk/branches + assert: + that: + - "tags.stat.isreg" + - "head.stat.isreg" + - "branches.stat.isreg" + +- name: verify on a reclone things are marked unchanged + assert: + that: + - "not hg_result2.changed" + + + +