Debian Codegraph @

ansible_collections/vmware/vmware_rest/docs/docsite/rst/dev_guide.rst

raw
1 .. _ansible_collections.vmware.vmware_rest.docsite.vmware_rest_devguide:
2
3 *********************************************
4 Guidelines for VMware REST module development
5 *********************************************
6
7 The Ansible VMware REST collection (on ``Galaxy <https://galaxy.ansible.com/vmware/vmware_rest>``, source code ``repository <https://github.com/ansible-collections/vmware.vmware_rest>``) is maintained by Red Hat and the community.
8
9 .. contents::
10 :local:
11
12 Contribution process
13 ====================
14
15 The modules of the vmware_rest collection are autogenerated by another tool called ``content_builder <https://github.com/ansible-community/ansible.content_builder>``.
16
17 If you would like to contribute a change, we would appreciate if you opened an issue in this repo.
18
19 Requirements
20 ============
21
22 You will need:
23
24 - Python 3.6 or greater
25 - the ``tox <https://tox.readthedocs.io/en/latest/install.html>`` command
26
27
28 Module Generation
29 ==========================
30
31 See the ``development.md`` file in this repo.
32
33 Testing with ansible-test
34 =========================
35
36 All the modules are covered by a functional test. The tests are located in the ``tests/integration/targets/``.
37
38 To run the tests, you will need a vcenter instance and an ESXi.
39
40 black code formatter
41 ^^^^^^^^^^^^^^^^^^^^
42
43 We follow the coding style of ``Black <https://github.com/psf/black>``.
44 You can run the code formatter with the following command.
45
46
47 .. code-block:: shell
48
49 tox -e black
50
51 sanity tests
52 ^^^^^^^^^^^^
53
54 Here we use Python 3.8, the minimal version is 3.6.
55
56 .. code-block:: shell
57
58 tox -e black
59 ansible-test sanity --debug --requirements --local --skip-test future-import-boilerplate --skip-test metaclass-boilerplate --python 3.8 -vvv
60
61
62 integration tests
63 ^^^^^^^^^^^^^^^^^
64
65 These tests should be run against your test environment.
66
67 ..warning:: The test suite will delete all the existing DC from your test environment.
68
69 First, prepare a configuration file, we call it ``/tmp/inventory-vmware_rest`` in
70 this example:
71
72 .. code-block:: ini
73
74 [vmware_rest]
75 localhost ansible_connection=local ansible_python_interpreter=python
76
77 [vmware_rest:vars]
78 vcenter_hostname=vcenter.test
79 [email protected]
80 vcenter_password=kLRy|FXwZSHXW0w?Q:sO
81 esxi1_hostname=esxi1.test
82 esxi1_username=zuul
83 esxi1_password=f6QYNi65k05kv8m56
84
85
86 To run the tests, use the following command. You may want to adjust the Python version.
87
88 .. code-block:: shell
89
90 ansible-test network-integration --diff --no-temp-workdir --python 3.8 --inventory /tmp/inventory-vmware_rest zuul/
91