Debian Codegraph @

ansible_collections/community/general/tests/integration/targets/hg/tasks/run-tests.yml

raw
1 # test code for the hg module
2 # Copyright (c) 2018, Ansible Project
3 #
4 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
5 # SPDX-License-Identifier: GPL-3.0-or-later
6
7 - name: set variables for tests
8 set_fact:
9 repo: "http://hg.code.sf.net/p/cg-hg-test-repo/hgtest"
10 checkout_dir: "{{ remote_tmp_dir }}/hg_project_test"
11
12 - name: clean out the remote_tmp_dir
13 shell: rm -rf "{{ checkout_dir }}"
14
15 - name: verify that mercurial is installed so this test can continue
16 shell: which hg
17
18 - name: initial checkout
19 hg:
20 repo: "{{ repo }}"
21 dest: "{{ checkout_dir }}"
22 register: hg_result
23
24 - shell: ls {{ checkout_dir }}
25
26 - name: verify information about the initial clone
27 assert:
28 that:
29 - "'before' in hg_result"
30 - "'after' in hg_result"
31 - "not hg_result.before"
32 - "hg_result.changed"
33
34 - name: repeated checkout
35 hg:
36 repo: "{{ repo }}"
37 dest: "{{ checkout_dir }}"
38 register: hg_result2
39
40 - debug: var=hg_result2
41
42 - name: check if tags exists
43 stat:
44 path: "{{ checkout_dir }}/.hgtags"
45 register: hg_tags
46
47 - name: check for remotes
48 stat:
49 path: "{{ checkout_dir }}/.hg/branch"
50 register: branches
51
52 - name: assert presence of tags/trunk/branches
53 assert:
54 that:
55 - "hg_tags.stat.isreg"
56 - "branches.stat.isreg"
57
58 - name: verify on a re-clone things are marked unchanged
59 assert:
60 that:
61 - "not hg_result2.changed"
62
63 - name: Checkout non-existent repo clone
64 hg:
65 repo: "http://hg.code.sf.net/p/cg-hg-test-repo1"
66 clone: false
67 update: false
68 register: hg_result3
69 ignore_errors: true
70
71 - name: Verify result of non-existent repo clone
72 assert:
73 that:
74 - "'abort: HTTP Error' in hg_result3.msg"
75 - "not hg_result3.changed"