Docs: Typos and edits in collections integration (#79228)

pull/79230/head
Goodness Chris-Ugari 2 years ago committed by GitHub
parent 04957715cc
commit 74f55db5c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -5,7 +5,7 @@ Creating new integration tests
This section covers the following cases: This section covers the following cases:
- There are no integration tests for a collection / group of modules in a collection at all. - There are no integration tests for a collection or group of modules in a collection at all.
- You are adding a new module and you want to include integration tests. - You are adding a new module and you want to include integration tests.
- You want to add integration tests for a module that already exists without integration tests. - You want to add integration tests for a module that already exists without integration tests.
@ -92,7 +92,7 @@ Add the following to ``tests/integration/targets/abstract_service_info/tasks/mai
- name: Fetch info from abstract service - name: Fetch info from abstract service
abstract_service_info: abstract_service_info:
host: 127.0.0.1 # We assume the service accepts local connection by default host: 127.0.0.1 # We assume the service accepts local connection by default
port: 1234 # We assume that the service is listening this port by default port: 1234 # We assume that the service is listening to this port by default
register: result # This variable will contain the returned JSON including the server version register: result # This variable will contain the returned JSON including the server version
- name: Test the output - name: Test the output
@ -104,7 +104,7 @@ Add the following to ``tests/integration/targets/abstract_service_info/tasks/mai
If there are any issues with connectivity (for example, the service is not accepting connections) or with the code, the play will fail. If there are any issues with connectivity (for example, the service is not accepting connections) or with the code, the play will fail.
Examine the output to see at which step the failure occurred. Investigate the reason, fix, and run again. Repeat the cycle until the test passes. Examine the output to see at which step the failure occurred. Investigate the reason, fix it, and run again. Repeat the cycle until the test passes.
8. If the test succeeds, write more tests. Refer to the :ref:`Recommendations on coverage<collection_integration_recommendations>` section for details. 8. If the test succeeds, write more tests. Refer to the :ref:`Recommendations on coverage<collection_integration_recommendations>` section for details.
@ -201,7 +201,7 @@ That is enough for our very basic example.
mkdir -p tests/integration/targets/postgresql_info/tasks tests/integration/targets/postgresql_info/meta mkdir -p tests/integration/targets/postgresql_info/tasks tests/integration/targets/postgresql_info/meta
11. To make the ``setup_postgresql_db`` target running before the ``postgresql_info`` target as a dependency, create the ``tests/integration/targets/postgresql_info/meta/main.yml`` file and add the following code to it: 11. To make the ``setup_postgresql_db`` target run before the ``postgresql_info`` target as a dependency, create the ``tests/integration/targets/postgresql_info/meta/main.yml`` file and add the following code to it:
.. code-block:: yaml .. code-block:: yaml
@ -247,4 +247,4 @@ The tests should pass. If we look at the output, we should see something like th
"msg": "All assertions passed" "msg": "All assertions passed"
} }
If your tests fail when you are working on your project, examine the output to see at which step the failure occurred. Investigate the reason, fix, and run again. Repeat the cycle until the test passes. If the test succeeds, write more tests. Refer to the :ref:`Recommendations on coverage<collection_integration_recommendations>` section for details. If your tests fail when you are working on your project, examine the output to see at which step the failure occurred. Investigate the reason, fix it, and run again. Repeat the cycle until the test passes. If the test succeeds, write more tests. Refer to the :ref:`Recommendations on coverage<collection_integration_recommendations>` section for details.

@ -3,7 +3,7 @@
Running integration tests Running integration tests
============================ ============================
In the following examples, we will use ``Docker`` to run integration tests locally. Ensure you have :ref:`collection_prepare_environment` first. In the following examples, we will use ``Docker`` to run integration tests locally. Ensure you :ref:`collection_prepare_environment` first.
We assume that you are in the ``~/ansible_collections/NAMESPACE/COLLECTION`` directory. We assume that you are in the ``~/ansible_collections/NAMESPACE/COLLECTION`` directory.
@ -25,7 +25,7 @@ In the examples above, the ``fedora34`` test image will be automatically downloa
See the :ref:`list of supported container images <test_container_images>`. See the :ref:`list of supported container images <test_container_images>`.
In some cases, for example, for platform independent tests, the ``default`` test image is required. Use the ``--docker default`` or just ``--docker`` option without specifying a distribution in this case. In some cases, for example, for platform-independent tests, the ``default`` test image is required. Use the ``--docker default`` or just ``--docker`` option without specifying a distribution in this case.
.. note:: .. note::

@ -6,7 +6,7 @@ Adding to an existing integration test
The test tasks are stored in the ``tests/integration/targets/<target_name>/tasks`` directory. The test tasks are stored in the ``tests/integration/targets/<target_name>/tasks`` directory.
The ``main.yml`` file holds test tasks and includes other test files. The ``main.yml`` file holds test tasks and includes other test files.
Look for a suitable test file to integrate your tests or create and include / import a separate test file. Look for a suitable test file to integrate your tests or create and include or import a separate test file.
You can use one of the existing test files as a draft. You can use one of the existing test files as a draft.
When fixing a bug When fixing a bug
@ -15,9 +15,9 @@ When fixing a bug
When fixing a bug: When fixing a bug:
1. :ref:`Determine if integration tests for the module exist<collection_integration_prepare>`. If they do not, see :ref:`collection_creating_integration_tests` section. 1. :ref:`Determine if integration tests for the module exist<collection_integration_prepare>`. If they do not, see :ref:`collection_creating_integration_tests` section.
2. Add a task which reproduces the bug to an appropriate file within the ``tests/integration/targets/<target_name>/tasks`` directory. 2. Add a task that reproduces the bug to an appropriate file within the ``tests/integration/targets/<target_name>/tasks`` directory.
3. :ref:`Run the tests<collection_run_integration_tests>`. The newly added task should fail. 3. :ref:`Run the tests<collection_run_integration_tests>`. The newly added task should fail.
4. If they do not fail, re-check if your environment / test task satisfies the conditions described in the ``Steps to Reproduce`` section of the issue. 4. If they do not fail, re-check if your environment or test task satisfies the conditions described in the ``Steps to Reproduce`` section of the issue.
5. If you reproduce the bug and tests fail, change the code. 5. If you reproduce the bug and tests fail, change the code.
6. :ref:`Run the tests<collection_run_integration_tests>` again. 6. :ref:`Run the tests<collection_run_integration_tests>` again.
7. If they fail, repeat steps 5-6 until the tests pass. 7. If they fail, repeat steps 5-6 until the tests pass.
@ -74,7 +74,7 @@ When adding a new feature
The process described in this section also applies when you want to add integration tests to a feature that already exists, but is missing integration tests. The process described in this section also applies when you want to add integration tests to a feature that already exists, but is missing integration tests.
If you have not already implemented the new feature, you can start with writing the integration tests for it. Of course they will not work as the code does not yet exist, but it can help you improve your implementation design before you start writing any code. If you have not already implemented the new feature, you can start by writing the integration tests for it. They will not work as the code does not yet exist, but they can help you improve your implementation design before you start writing any code.
When adding new features, the process of adding tests consists of the following steps: When adding new features, the process of adding tests consists of the following steps:

Loading…
Cancel
Save