summaryrefslogtreecommitdiff
path: root/test/integration/targets/ansible-doc/test.yml
blob: a6944c44622655cb305ec3215a0b47c73057d73d (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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
- hosts: localhost
  gather_facts: no
  environment:
    ANSIBLE_LIBRARY: "{{ playbook_dir }}/library"
  tasks:
    - name: non-existent module
      command: ansible-doc test_does_not_exist
      register: result
    - assert:
        that:
          - '"[WARNING]: module test_does_not_exist not found in:" in result.stderr'

    - name: documented module
      command: ansible-doc test_docs
      register: result
    - assert:
        that:
          - '"WARNING" not in result.stderr'
          - '"TEST_DOCS " in result.stdout'
          - '"AUTHOR: Ansible Core Team" in result.stdout'

    - name: documented module without metadata
      command: ansible-doc test_docs_no_metadata
      register: result
    - assert:
        that:
          - '"WARNING" not in result.stderr'
          - '"TEST_DOCS_NO_METADATA " in result.stdout'
          - '"AUTHOR: Ansible Core Team" in result.stdout'

    - name: documented module with no status in metadata
      command: ansible-doc test_docs_no_status
      register: result
    - assert:
        that:
          - '"WARNING" not in result.stderr'
          - '"TEST_DOCS_NO_STATUS " in result.stdout'
          - '"AUTHOR: Ansible Core Team" in result.stdout'

    - name: documented module with non-iterable status in metadata
      command: ansible-doc test_docs_non_iterable_status
      register: result
    - assert:
        that:
          - '"WARNING" not in result.stderr'
          - '"TEST_DOCS_NON_ITERABLE_STATUS " in result.stdout'
          - '"AUTHOR: Ansible Core Team" in result.stdout'

    - name: documented module with removed status
      command: ansible-doc test_docs_removed_status
      register: result
    - assert:
        that:
          - '"WARNING" not in result.stderr'
          - '"TEST_DOCS_REMOVED_STATUS " in result.stdout'
          - '"AUTHOR: Ansible Core Team" in result.stdout'

    - name: empty module
      command: ansible-doc test_empty
      register: result
    - assert:
        that:
          - 'result.stdout == ""'
          - 'result.stderr == ""'

    - name: module with no documentation
      command: ansible-doc test_no_docs
      register: result
    - assert:
        that:
          - 'result.stdout == ""'
          - 'result.stderr == ""'

    - name: module with no documentation and no metadata
      command: ansible-doc test_no_docs_no_metadata
      register: result
    - assert:
        that:
          - 'result.stdout == ""'
          - 'result.stderr == ""'

    - name: module with no documentation and no status in metadata
      command: ansible-doc test_no_docs_no_status
      ignore_errors: yes
      register: result
    - assert:
        that:
          - 'result is failed'
          - '"ERROR! module test_no_docs_no_status missing documentation (or could not parse documentation): test_no_docs_no_status did not contain a DOCUMENTATION attribute" in result.stderr'

    - name: module with no documentation and non-iterable status in metadata
      command: ansible-doc test_no_docs_non_iterable_status
      ignore_errors: yes
      register: result
    - assert:
        that:
          - 'result is failed'
          - '"ERROR! module test_no_docs_non_iterable_status missing documentation (or could not parse documentation): test_no_docs_non_iterable_status did not contain a DOCUMENTATION attribute" in result.stderr'