mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Add max-arnold's tests and associated cleanup
This commit is contained in:
parent
28b9973dcb
commit
ebf8417c61
10 changed files with 131 additions and 32 deletions
|
@ -14,8 +14,8 @@ beacon modules
|
|||
aix_account
|
||||
avahi_announce
|
||||
bonjour_announce
|
||||
cert_info
|
||||
btmp
|
||||
cert_info
|
||||
diskusage
|
||||
glxinfo
|
||||
haproxy
|
||||
|
|
|
@ -10,8 +10,8 @@ grains modules
|
|||
:toctree:
|
||||
:template: autosummary.rst.tmpl
|
||||
|
||||
cimc
|
||||
chronos
|
||||
cimc
|
||||
core
|
||||
disks
|
||||
esxi
|
||||
|
@ -31,7 +31,7 @@ grains modules
|
|||
opts
|
||||
panos
|
||||
philips_hue
|
||||
rest_sample
|
||||
smartos
|
||||
ssh_sample
|
||||
rest_sample
|
||||
zfs
|
||||
|
|
|
@ -32,8 +32,8 @@ execution modules
|
|||
apcups
|
||||
apf
|
||||
apkpkg
|
||||
aptpkg
|
||||
aptly
|
||||
aptpkg
|
||||
archive
|
||||
arista_pyeapi
|
||||
artifactory
|
||||
|
@ -120,10 +120,10 @@ execution modules
|
|||
ddns
|
||||
deb_apache
|
||||
deb_postgres
|
||||
debuild_pkgbuild
|
||||
debconfmod
|
||||
debian_ip
|
||||
debian_service
|
||||
debuild_pkgbuild
|
||||
defaults
|
||||
devmap
|
||||
dig
|
||||
|
@ -189,12 +189,12 @@ execution modules
|
|||
highstate_doc
|
||||
hosts
|
||||
http
|
||||
icinga2
|
||||
ifttt
|
||||
ilo
|
||||
icinga2
|
||||
incron
|
||||
influxdbmod
|
||||
influxdb08mod
|
||||
influxdbmod
|
||||
infoblox
|
||||
ini_manage
|
||||
inspectlib
|
||||
|
@ -241,6 +241,8 @@ execution modules
|
|||
linux_acl
|
||||
linux_ip
|
||||
linux_lvm
|
||||
linux_service
|
||||
linux_shadow
|
||||
linux_sysctl
|
||||
localemod
|
||||
locate
|
||||
|
@ -252,11 +254,9 @@ execution modules
|
|||
lxd
|
||||
mac_assistive
|
||||
mac_brew_pkg
|
||||
macdefaults
|
||||
mac_desktop
|
||||
mac_group
|
||||
mac_keychain
|
||||
macpackage
|
||||
mac_pkgutil
|
||||
mac_portspkg
|
||||
mac_power
|
||||
|
@ -268,6 +268,8 @@ execution modules
|
|||
mac_timezone
|
||||
mac_user
|
||||
mac_xattr
|
||||
macdefaults
|
||||
macpackage
|
||||
makeconf
|
||||
mandrill
|
||||
marathon
|
||||
|
@ -291,16 +293,15 @@ execution modules
|
|||
nacl
|
||||
nagios
|
||||
nagios_rpc
|
||||
namecheap_domains_dns
|
||||
namecheap_domains
|
||||
namecheap_domains_dns
|
||||
namecheap_domains_ns
|
||||
namecheap_ssl
|
||||
namecheap_users
|
||||
napalm_mod
|
||||
napalm_netacl
|
||||
napalm_bgp
|
||||
napalm_formula
|
||||
napalm_mod
|
||||
napalm_netacl
|
||||
napalm_network
|
||||
napalm_ntp
|
||||
napalm_probes
|
||||
|
@ -417,9 +418,7 @@ execution modules
|
|||
sensehat
|
||||
sensors
|
||||
serverdensity_device
|
||||
service
|
||||
servicenow
|
||||
shadow
|
||||
slack_notify
|
||||
slsutil
|
||||
smartos_imgadm
|
||||
|
@ -429,6 +428,7 @@ execution modules
|
|||
smbios
|
||||
smf_service
|
||||
smtp
|
||||
snapper
|
||||
solaris_fmadm
|
||||
solaris_group
|
||||
solaris_shadow
|
||||
|
@ -444,7 +444,6 @@ execution modules
|
|||
ssh
|
||||
ssh_pkg
|
||||
ssh_service
|
||||
snapper
|
||||
state
|
||||
status
|
||||
statuspage
|
||||
|
@ -465,8 +464,8 @@ execution modules
|
|||
telemetry
|
||||
temp
|
||||
test
|
||||
testinframod
|
||||
test_virtual
|
||||
testinframod
|
||||
textfsm_mod
|
||||
timezone
|
||||
tls
|
||||
|
@ -514,7 +513,6 @@ execution modules
|
|||
win_pki
|
||||
win_powercfg
|
||||
win_psget
|
||||
winrepo
|
||||
win_servermanager
|
||||
win_service
|
||||
win_shadow
|
||||
|
@ -527,6 +525,7 @@ execution modules
|
|||
win_useradd
|
||||
win_wua
|
||||
win_wusa
|
||||
winrepo
|
||||
wordpress
|
||||
x509
|
||||
xapi_virt
|
||||
|
|
|
@ -4,9 +4,12 @@
|
|||
netapi modules
|
||||
==============
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
.. currentmodule:: salt.netapi
|
||||
|
||||
salt.netapi.rest_cherrypy
|
||||
salt.netapi.rest_tornado
|
||||
salt.netapi.rest_wsgi
|
||||
.. autosummary::
|
||||
:toctree:
|
||||
:template: autosummary.rst.tmpl
|
||||
|
||||
rest_cherrypy
|
||||
rest_tornado
|
||||
rest_wsgi
|
||||
|
|
|
@ -5,6 +5,8 @@ rest_cherrypy
|
|||
.. contents::
|
||||
:local:
|
||||
|
||||
.. automodule:: salt.netapi.rest_cherrypy
|
||||
|
||||
.. automodule:: salt.netapi.rest_cherrypy.app
|
||||
|
||||
.. automodule:: salt.netapi.rest_cherrypy.wsgi
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
rest_tornado
|
||||
============
|
||||
|
||||
.. automodule:: salt.netapi.rest_tornado
|
||||
|
||||
.. automodule:: salt.netapi.rest_tornado.saltnado
|
||||
|
||||
.. automodule:: salt.netapi.rest_tornado.saltnado_websockets
|
||||
|
@ -54,4 +56,4 @@ REST URI Reference
|
|||
---------
|
||||
|
||||
.. autoclass:: WebhookSaltAPIHandler
|
||||
:members: post
|
||||
:members: post
|
||||
|
|
|
@ -11,7 +11,6 @@ proxy modules
|
|||
:template: autosummary.rst.tmpl
|
||||
|
||||
arista_pyeapi
|
||||
cimc
|
||||
chronos
|
||||
cimc
|
||||
cisconso
|
||||
|
|
|
@ -95,12 +95,12 @@ state modules
|
|||
elasticsearch_index_template
|
||||
environ
|
||||
eselect
|
||||
etcd_mod
|
||||
ethtool
|
||||
esxcluster
|
||||
esxdatacenter
|
||||
esxi
|
||||
esxvm
|
||||
etcd_mod
|
||||
ethtool
|
||||
event
|
||||
file
|
||||
firewall
|
||||
|
@ -182,10 +182,10 @@ state modules
|
|||
lxd_image
|
||||
lxd_profile
|
||||
mac_assistive
|
||||
macdefaults
|
||||
mac_keychain
|
||||
macpackage
|
||||
mac_xattr
|
||||
macdefaults
|
||||
macpackage
|
||||
makeconf
|
||||
marathon_app
|
||||
mdadm_raid
|
||||
|
@ -206,13 +206,13 @@ state modules
|
|||
mysql_grants
|
||||
mysql_query
|
||||
mysql_user
|
||||
net_napalm_yang
|
||||
netacl
|
||||
netconfig
|
||||
netntp
|
||||
netsnmp
|
||||
netusers
|
||||
network
|
||||
net_napalm_yang
|
||||
neutron_network
|
||||
neutron_secgroup
|
||||
neutron_secgroup_rule
|
||||
|
@ -235,8 +235,8 @@ state modules
|
|||
panos
|
||||
pbm
|
||||
pcs
|
||||
pecl
|
||||
pdbedit
|
||||
pecl
|
||||
pip_state
|
||||
pkg
|
||||
pkgbuild
|
||||
|
@ -351,8 +351,8 @@ state modules
|
|||
zabbix_valuemap
|
||||
zcbuildout
|
||||
zenoss
|
||||
zk_concurrency
|
||||
zfs
|
||||
zk_concurrency
|
||||
zone
|
||||
zookeeper
|
||||
zpool
|
||||
|
|
|
@ -9,6 +9,7 @@ from __future__ import absolute_import
|
|||
import os
|
||||
import re
|
||||
import logging
|
||||
import collections
|
||||
|
||||
# Import Salt Testing libs
|
||||
from tests.support.unit import TestCase
|
||||
|
@ -119,6 +120,13 @@ class DocTestCase(TestCase):
|
|||
module_name = os.path.splitext(file)[0]
|
||||
if module_name not in skip_module_files:
|
||||
module_files.append(module_name)
|
||||
# Capture modules in subdirectories like inspectlib and rest_cherrypy
|
||||
elif (os.path.isdir(os.path.join(full_module_dir, file)) and
|
||||
not file.startswith('_') and
|
||||
os.path.isfile(os.path.join(full_module_dir, file, '__init__.py'))):
|
||||
module_name = file
|
||||
if module_name not in skip_module_files:
|
||||
module_files.append(module_name)
|
||||
|
||||
# Build list of documentation files
|
||||
module_docs = []
|
||||
|
@ -133,6 +141,22 @@ class DocTestCase(TestCase):
|
|||
if doc_name not in skip_doc_files:
|
||||
module_docs.append(doc_name)
|
||||
|
||||
module_index_file = os.path.join(full_module_doc_dir, 'index.rst')
|
||||
with salt.utils.files.fopen(module_index_file, 'rb') as fp:
|
||||
module_index_contents = fp.read().decode('utf-8')
|
||||
|
||||
module_index_block = re.search(r"""
|
||||
\.\.\s+autosummary::\s*\n
|
||||
(\s+:[a-z]+:.*\n)*
|
||||
(\s*\n)+
|
||||
(?P<mods>(\s*[a-z0-9_\.]+\s*\n)+)
|
||||
""", module_index_contents, flags=re.VERBOSE)
|
||||
|
||||
module_index = re.findall(
|
||||
r"""\s*([a-z0-9_\.]+)\s*\n""",
|
||||
module_index_block.group('mods')
|
||||
)
|
||||
|
||||
# Check that every module has associated documentation file
|
||||
for module in module_files:
|
||||
self.assertIn(module,
|
||||
|
@ -140,6 +164,13 @@ class DocTestCase(TestCase):
|
|||
'module file {0} is missing documentation in {1}'.format(module,
|
||||
full_module_doc_dir))
|
||||
|
||||
# Check that every module is listed in the index file
|
||||
self.assertIn(
|
||||
module,
|
||||
module_index,
|
||||
'module file {0} is missing in {1}'.format(module, module_index_file)
|
||||
)
|
||||
|
||||
# Check if .rst file for this module contains the text
|
||||
# ".. _virtual" indicating it is a virtual doc page
|
||||
full_module_doc_name = os.path.join(full_module_doc_dir, doc_prefix + module + '.rst')
|
||||
|
@ -155,6 +186,27 @@ class DocTestCase(TestCase):
|
|||
module_files,
|
||||
'Doc file {0} is missing associated module in {1}'.format(doc_file,
|
||||
full_module_dir))
|
||||
# Check that a module index is sorted
|
||||
sorted_module_index = sorted(module_index)
|
||||
self.assertEqual(
|
||||
module_index,
|
||||
sorted_module_index,
|
||||
msg='Module index is not sorted: {}'.format(module_index_file)
|
||||
)
|
||||
|
||||
# Check for duplicates inside of a module index
|
||||
module_index_duplicates = [mod for mod, count in collections.Counter(module_index).items() if count > 1]
|
||||
if module_index_duplicates:
|
||||
self.fail('Module index {0} contains duplicates: {1}'.format(module_index_file, module_index_duplicates))
|
||||
|
||||
# Check for stray module docs
|
||||
# Do not check files listed in doc_skip
|
||||
stray_modules = set(module_index).difference(module_files + doc_skip)
|
||||
if stray_modules:
|
||||
self.fail('Stray module names {0} in the doc index {1}'.format(sorted(list(stray_modules)), module_index_file))
|
||||
stray_modules = set(module_docs).difference(module_files)
|
||||
if stray_modules:
|
||||
self.fail('Stray module doc files {0} in the doc folder {1}'.format(sorted(list(stray_modules)), full_module_doc_dir))
|
||||
|
||||
def test_auth_doc_files(self):
|
||||
'''
|
||||
|
@ -226,6 +278,20 @@ class DocTestCase(TestCase):
|
|||
doc_dir = ['doc', 'ref', 'engines', 'all']
|
||||
self._check_doc_files(skip_module_files, module_dir, skip_doc_files, doc_dir)
|
||||
|
||||
def test_executors_doc_files(self):
|
||||
'''
|
||||
Ensure executor modules have associated documentation
|
||||
|
||||
doc example: doc/ref/executors/all/salt.executors.docker.rst
|
||||
engine module example: salt/executors/docker.py
|
||||
'''
|
||||
|
||||
skip_module_files = ['__init__']
|
||||
module_dir = ['salt', 'executors']
|
||||
skip_doc_files = ['index', 'all']
|
||||
doc_dir = ['doc', 'ref', 'executors', 'all']
|
||||
self._check_doc_files(skip_module_files, module_dir, skip_doc_files, doc_dir)
|
||||
|
||||
def test_fileserver_doc_files(self):
|
||||
'''
|
||||
Ensure fileserver modules have associated documentation
|
||||
|
@ -264,13 +330,27 @@ class DocTestCase(TestCase):
|
|||
|
||||
skip_module_files = ['__init__']
|
||||
module_dir = ['salt', 'modules']
|
||||
skip_doc_files = ['index', 'group', 'inspectlib', 'inspectlib.collector', 'inspectlib.dbhandle',
|
||||
skip_doc_files = ['index', 'group', 'inspectlib.collector', 'inspectlib.dbhandle',
|
||||
'inspectlib.entities', 'inspectlib.exceptions', 'inspectlib.fsdb',
|
||||
'inspectlib.kiwiproc', 'inspectlib.query', 'kernelpkg', 'pkg', 'user',
|
||||
'service', 'shadow']
|
||||
doc_dir = ['doc', 'ref', 'modules', 'all']
|
||||
self._check_doc_files(skip_module_files, module_dir, skip_doc_files, doc_dir)
|
||||
|
||||
def test_netapi_doc_files(self):
|
||||
'''
|
||||
Ensure netapi modules have associated documentation
|
||||
|
||||
doc example: doc/ref/netapi/all/salt.netapi.rest_cherrypy.rst
|
||||
module example: salt/netapi/rest_cherrypy
|
||||
'''
|
||||
|
||||
skip_module_files = ['__init__']
|
||||
module_dir = ['salt', 'netapi']
|
||||
skip_doc_files = ['index', 'all']
|
||||
doc_dir = ['doc', 'ref', 'netapi', 'all']
|
||||
self._check_doc_files(skip_module_files, module_dir, skip_doc_files, doc_dir)
|
||||
|
||||
def test_output_doc_files(self):
|
||||
'''
|
||||
Ensure output modules have associated documentation
|
||||
|
@ -425,6 +505,20 @@ class DocTestCase(TestCase):
|
|||
doc_dir = ['doc', 'ref', 'thorium', 'all']
|
||||
self._check_doc_files(skip_module_files, module_dir, skip_doc_files, doc_dir)
|
||||
|
||||
def test_token_doc_files(self):
|
||||
'''
|
||||
Ensure token modules have associated documentation
|
||||
|
||||
doc example: doc/ref/tokens/all/salt.tokens.localfs.rst
|
||||
module example: salt/tokens/localfs.py
|
||||
'''
|
||||
|
||||
skip_module_files = ['__init__']
|
||||
module_dir = ['salt', 'tokens']
|
||||
skip_doc_files = ['index', 'all']
|
||||
doc_dir = ['doc', 'ref', 'tokens', 'all']
|
||||
self._check_doc_files(skip_module_files, module_dir, skip_doc_files, doc_dir)
|
||||
|
||||
def test_tops_doc_files(self):
|
||||
'''
|
||||
Ensure top modules have associated documentation
|
||||
|
|
Loading…
Add table
Reference in a new issue