summaryrefslogtreecommitdiff
path: root/test/integration/roles/test_hg/tasks/main.yml
blob: 4eee22e4c7ef834682081bd66d6a56583b909f2c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# test code for the hg module
# (c) 2014, James Tanner <tanner.jc@gmail.com>

# 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 <http://www.gnu.org/licenses/>.

- 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 remotes
  stat: path={{ checkout_dir }}/.hg/branch
  register: branches

- debug: var=tags
- debug: var=branches

- name: assert presence of tags/trunk/branches
  assert:
    that:
      - "tags.stat.isreg"
      - "branches.stat.isreg"

- name: verify on a reclone things are marked unchanged
  assert:
    that:
      - "not hg_result2.changed"