Update docs for main

This commit is contained in:
kubevirt-bot
2023-08-07 12:27:23 +00:00
parent e9ca32f162
commit 3003974b30
7 changed files with 211 additions and 261 deletions

View File

@@ -53,7 +53,7 @@
<ul class="current">
<li class="toctree-l1 current"><a class="current reference internal" href="#">Testing</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#continuous-integration">Continuous integration</a></li>
<li class="toctree-l2"><a class="reference internal" href="#test-playbooks">Test playbooks</a></li>
<li class="toctree-l2"><a class="reference internal" href="#example-config-and-playbooks">Example config and playbooks</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="developing.html">Contributors Guidelines</a></li>
@@ -92,32 +92,30 @@
<h1>Testing<a class="headerlink" href="#testing" title="Permalink to this heading"></a></h1>
<section id="continuous-integration">
<h2>Continuous integration<a class="headerlink" href="#continuous-integration" title="Permalink to this heading"></a></h2>
<p>The collection is tested with a <a class="reference external" href="https://github.com/ansible-community/molecule">molecule</a> setup covering the included roles and verifying correct installation and idempotency.
In order to run the molecule tests locally with python 3.9 available, after cloning the repository:</p>
<div class="highlight-YAML+Jinja notranslate"><div class="highlight"><pre><span></span><span class="l l-Scalar l-Scalar-Plain">pip install yamllint &#39;molecule[docker]~=3.5.2&#39; ansible-core flake8 ansible-lint voluptuous</span>
<span class="l l-Scalar l-Scalar-Plain">molecule test --all</span>
</pre></div>
</div>
<p>The <code class="docutils literal notranslate"><span class="pre">hack/e2e-setup.sh</span></code> script contains the steps necessary to reproduce the CI test environment, which relies on <code class="docutils literal notranslate"><span class="pre">kubectl</span></code> and <code class="docutils literal notranslate"><span class="pre">kind</span></code>.</p>
</section>
<section id="test-playbooks">
<h2>Test playbooks<a class="headerlink" href="#test-playbooks" title="Permalink to this heading"></a></h2>
<p>Sample playbooks are provided in the <code class="docutils literal notranslate"><span class="pre">playbooks/</span></code> directory; to run the playbooks locally (requires a rhel system with python 3.9+, ansible, and systemd) the steps are as follows:</p>
<div class="highlight-YAML+Jinja notranslate"><div class="highlight"><pre><span></span><span class="c1"># setup environment</span>
<span class="l l-Scalar l-Scalar-Plain">pip install ansible-core</span>
<span class="l l-Scalar l-Scalar-Plain"># clone the repository</span>
<span class="l l-Scalar l-Scalar-Plain">git clone https://github.com/ansible-middleware/amq</span>
<span class="l l-Scalar l-Scalar-Plain">cd amq</span>
<span class="l l-Scalar l-Scalar-Plain"># install collection dependencies</span>
<span class="l l-Scalar l-Scalar-Plain">ansible-galaxy collection install -r requirements.yml</span>
<span class="l l-Scalar l-Scalar-Plain"># install collection python deps</span>
<span class="l l-Scalar l-Scalar-Plain">pip install -r requirements.txt</span>
<span class="l l-Scalar l-Scalar-Plain"># create inventory for localhost</span>
<span class="l l-Scalar l-Scalar-Plain">cat &lt;&lt; EOF &gt; inventory</span>
<span class="l l-Scalar l-Scalar-Plain">[amq]</span>
<span class="l l-Scalar l-Scalar-Plain">localhost ansible_connection=local</span>
<span class="l l-Scalar l-Scalar-Plain">EOF</span>
<span class="l l-Scalar l-Scalar-Plain"># run the playbook</span>
<span class="l l-Scalar l-Scalar-Plain">ansible-playbook -i inventory playbooks/activemq.yml</span>
<section id="example-config-and-playbooks">
<h2>Example config and playbooks<a class="headerlink" href="#example-config-and-playbooks" title="Permalink to this heading"></a></h2>
<p>Sample playbooks and inventory configurations are provided in the <code class="docutils literal notranslate"><span class="pre">examples/</span></code> directory; to run the playbooks locally, build the testing environment with the script above, then the steps are as follows:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="c1"># setup environment</span>
pip<span class="w"> </span>install<span class="w"> </span>ansible-core
<span class="c1"># clone the repository</span>
git<span class="w"> </span>clone<span class="w"> </span>https://github.com/kubevirt/kubevirt.core
<span class="nb">cd</span><span class="w"> </span>kubevirt.core
<span class="c1"># install collection dependencies</span>
ansible-galaxy<span class="w"> </span>collection<span class="w"> </span>install<span class="w"> </span>-r<span class="w"> </span>requirements.yml
<span class="c1"># install collection python deps</span>
pip<span class="w"> </span>install<span class="w"> </span>-r<span class="w"> </span>requirements.txt
<span class="c1"># setup environment</span>
hack/e2e-setup.sh
<span class="c1"># run inventory source</span>
ansible-inventory<span class="w"> </span>-i<span class="w"> </span>examples/inventory.kubevirt.yml
<span class="c1"># create a virtual machine</span>
ansible-playbook<span class="w"> </span>-i<span class="w"> </span>examples/inventory.kubevirt.yml<span class="w"> </span>examples/play-create-min.yml
<span class="c1"># terminate a virtual machine</span>
ansible-playbook<span class="w"> </span>-i<span class="w"> </span>examples/inventory.kubevirt.yml<span class="w"> </span>examples/play-delete.yml
<span class="c1"># terminate the environment</span>
hack/e2e-setup.sh<span class="w"> </span>--cleanup
</pre></div>
</div>
</section>