Update docs for main

Signed-off-by: kubevirt-bot <kubevirtbot@redhat.com>
This commit is contained in:
kubevirt-bot
2024-07-01 14:48:42 +00:00
parent 9b907a0560
commit 5ad3ff075c
3 changed files with 46 additions and 1 deletions

View File

@@ -53,6 +53,32 @@ Run unit tests with `ansible-test` like so:
ANSIBLE_TEST_PREFER_PODMAN=1 ansible-test units --docker
```
### Running tests with coverage analysis
Coverage analysis produces a report about the code paths covered by the unit tests.
It is required to bind mount the project as shown in section [Running tests with ansible-test](#running-tests-with-ansible-test).
Run `ansible-test` with:
```
ANSIBLE_TEST_PREFER_PODMAN=1 ansible-test units --docker --coverage
```
Create the coverage report in HTML format using:
```
ansible-test coverage html
```
Or in XML format using:
```
ansible-test coverage xml
```
Multiple coverage report formats are supported such as: plain text, XML or HTML. If HTML format is used as shown above, the report can be accessed in the following location: `~/.ansible/collections/ansible_collections/kubevirt/tests/output/reports/coverage/index.html` or in `~/.ansible/collections/ansible_collections/kubevirt/tests/output/reports/coverage/coverage.xml` if XML format is choosen.
## Integration tests
Integration tests require a working cluster and can be run with

File diff suppressed because one or more lines are too long

View File

@@ -58,6 +58,7 @@
<li class="toctree-l2"><a class="reference internal" href="#sanity-and-unit-tests">Sanity and unit tests</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#running-tests-with-tox-ansible">Running tests with tox-ansible</a></li>
<li class="toctree-l3"><a class="reference internal" href="#running-tests-with-ansible-test">Running tests with ansible-test</a></li>
<li class="toctree-l3"><a class="reference internal" href="#running-tests-with-coverage-analysis">Running tests with coverage analysis</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#integration-tests">Integration tests</a><ul>
@@ -145,6 +146,24 @@ if you did not check it out into this location.</p>
</pre></div>
</div>
</section>
<section id="running-tests-with-coverage-analysis">
<h3>Running tests with coverage analysis<a class="headerlink" href="#running-tests-with-coverage-analysis" title="Link to this heading"></a></h3>
<p>Coverage analysis produces a report about the code paths covered by the unit tests.</p>
<p>It is required to bind mount the project as shown in section <a class="reference internal" href="#running-tests-with-ansible-test"><span class="xref myst">Running tests with ansible-test</span></a>.</p>
<p>Run <code class="docutils literal notranslate"><span class="pre">ansible-test</span></code> with:</p>
<div class="highlight-YAML+Jinja notranslate"><div class="highlight"><pre><span></span><span class="l l-Scalar l-Scalar-Plain">ANSIBLE_TEST_PREFER_PODMAN=1 ansible-test units --docker --coverage</span>
</pre></div>
</div>
<p>Create the coverage report in HTML format using:</p>
<div class="highlight-YAML+Jinja notranslate"><div class="highlight"><pre><span></span><span class="l l-Scalar l-Scalar-Plain">ansible-test coverage html</span>
</pre></div>
</div>
<p>Or in XML format using:</p>
<div class="highlight-YAML+Jinja notranslate"><div class="highlight"><pre><span></span><span class="l l-Scalar l-Scalar-Plain">ansible-test coverage xml</span>
</pre></div>
</div>
<p>Multiple coverage report formats are supported such as: plain text, XML or HTML. If HTML format is used as shown above, the report can be accessed in the following location: <code class="docutils literal notranslate"><span class="pre">~/.ansible/collections/ansible_collections/kubevirt/tests/output/reports/coverage/index.html</span></code> or in <code class="docutils literal notranslate"><span class="pre">~/.ansible/collections/ansible_collections/kubevirt/tests/output/reports/coverage/coverage.xml</span></code> if XML format is choosen.</p>
</section>
</section>
<section id="integration-tests">
<h2>Integration tests<a class="headerlink" href="#integration-tests" title="Link to this heading"></a></h2>