summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/integration/targets/ansible-doc/collections/ansible_collections/testns/testcol/plugins/modules/randommodule.py12
-rw-r--r--test/integration/targets/ansible-doc/fix-urls.py15
-rw-r--r--test/integration/targets/ansible-doc/randommodule-text.output19
-rw-r--r--test/integration/targets/ansible-doc/randommodule.output25
-rwxr-xr-xtest/integration/targets/ansible-doc/runme.sh4
5 files changed, 73 insertions, 2 deletions
diff --git a/test/integration/targets/ansible-doc/collections/ansible_collections/testns/testcol/plugins/modules/randommodule.py b/test/integration/targets/ansible-doc/collections/ansible_collections/testns/testcol/plugins/modules/randommodule.py
index f251a69f0e..79b7a704a1 100644
--- a/test/integration/targets/ansible-doc/collections/ansible_collections/testns/testcol/plugins/modules/randommodule.py
+++ b/test/integration/targets/ansible-doc/collections/ansible_collections/testns/testcol/plugins/modules/randommodule.py
@@ -48,6 +48,18 @@ options:
version: '2.0.0'
extends_documentation_fragment:
- testns.testcol2.module
+seealso:
+ - module: ansible.builtin.ping
+ - module: ansible.builtin.uri
+ description: Use this to fetch an URI
+ - module: testns.testcol.test
+ - module: testns.testcol.fakemodule
+ description: A fake module
+ - link: https://docs.ansible.com
+ name: Ansible docsite
+ description: See also the Ansible docsite.
+ - ref: foo_bar
+ description: Some foo bar.
'''
EXAMPLES = '''
diff --git a/test/integration/targets/ansible-doc/fix-urls.py b/test/integration/targets/ansible-doc/fix-urls.py
new file mode 100644
index 0000000000..1379a4e4a0
--- /dev/null
+++ b/test/integration/targets/ansible-doc/fix-urls.py
@@ -0,0 +1,15 @@
+"""Unwrap URLs to docs.ansible.com and remove version"""
+
+import re
+import sys
+
+
+def main():
+ data = sys.stdin.read()
+ data = re.sub('(https://docs\\.ansible\\.com/[^ ]+)\n +([^ ]+)\n', '\\1\\2\n', data, flags=re.MULTILINE)
+ data = re.sub('https://docs\\.ansible\\.com/ansible(|-core)/(?:[^/]+)/', 'https://docs.ansible.com/ansible\\1/devel/', data)
+ sys.stdout.write(data)
+
+
+if __name__ == '__main__':
+ main()
diff --git a/test/integration/targets/ansible-doc/randommodule-text.output b/test/integration/targets/ansible-doc/randommodule-text.output
index 51d7930a07..602d66ec9f 100644
--- a/test/integration/targets/ansible-doc/randommodule-text.output
+++ b/test/integration/targets/ansible-doc/randommodule-text.output
@@ -65,6 +65,25 @@ OPTIONS (= is mandatory):
type: str
+SEE ALSO:
+ * Module ansible.builtin.ping
+ The official documentation on the
+ ansible.builtin.ping module.
+ https://docs.ansible.com/ansible-core/devel/collections/ansible/builtin/ping_module.html
+ * Module ansible.builtin.uri
+ Use this to fetch an URI
+ https://docs.ansible.com/ansible-core/devel/collections/ansible/builtin/uri_module.html
+ * Module testns.testcol.test
+ * Module testns.testcol.fakemodule
+ A fake module
+ * Ansible docsite
+ See also the Ansible docsite.
+ https://docs.ansible.com
+ * Ansible documentation [foo_bar]
+ Some foo bar.
+ https://docs.ansible.com/ansible-core/devel/#stq=foo_bar&stp=1
+
+
AUTHOR: Ansible Core Team
EXAMPLES:
diff --git a/test/integration/targets/ansible-doc/randommodule.output b/test/integration/targets/ansible-doc/randommodule.output
index 25f46c3622..cf0360003a 100644
--- a/test/integration/targets/ansible-doc/randommodule.output
+++ b/test/integration/targets/ansible-doc/randommodule.output
@@ -70,6 +70,31 @@
"type": "str"
}
},
+ "seealso": [
+ {
+ "module": "ansible.builtin.ping"
+ },
+ {
+ "description": "Use this to fetch an URI",
+ "module": "ansible.builtin.uri"
+ },
+ {
+ "module": "testns.testcol.test"
+ },
+ {
+ "description": "A fake module",
+ "module": "testns.testcol.fakemodule"
+ },
+ {
+ "description": "See also the Ansible docsite.",
+ "link": "https://docs.ansible.com",
+ "name": "Ansible docsite"
+ },
+ {
+ "description": "Some foo bar.",
+ "ref": "foo_bar"
+ }
+ ],
"short_description": "A random module",
"version_added": "1.0.0",
"version_added_collection": "testns.testcol"
diff --git a/test/integration/targets/ansible-doc/runme.sh b/test/integration/targets/ansible-doc/runme.sh
index 887d3c417e..f51fa8a432 100755
--- a/test/integration/targets/ansible-doc/runme.sh
+++ b/test/integration/targets/ansible-doc/runme.sh
@@ -19,8 +19,8 @@ current_out="$(ansible-doc --playbook-dir ./ testns.testcol.fakemodule | sed '1
expected_out="$(sed '1 s/\(^> TESTNS\.TESTCOL\.FAKEMODULE\).*(.*)$/\1/' fakemodule.output)"
test "$current_out" == "$expected_out"
-# we use sed to strip the module path from the first line
-current_out="$(ansible-doc --playbook-dir ./ testns.testcol.randommodule | sed '1 s/\(^> TESTNS\.TESTCOL\.RANDOMMODULE\).*(.*)$/\1/')"
+# we use sed to strip the plugin path from the first line, and fix-urls.py to unbreak and replace URLs from stable-X branches
+current_out="$(ansible-doc --playbook-dir ./ testns.testcol.randommodule | sed '1 s/\(^> TESTNS\.TESTCOL\.RANDOMMODULE\).*(.*)$/\1/' | python fix-urls.py)"
expected_out="$(sed '1 s/\(^> TESTNS\.TESTCOL\.RANDOMMODULE\).*(.*)$/\1/' randommodule-text.output)"
test "$current_out" == "$expected_out"