Testing Farm Contribution Guide

Software

Poetry

All our Python projects MUST use Poetry for packaging. It is required to use poetry version 1.4.2.

To install Poetry use the following command:

curl -sSL https://install.python-poetry.org | python3 - --version 1.4.2

Ansible

It is required to use Ansible version 2.14.* both in development environment and Python projects.

To install Ansible use the following command:

sudo dnf install ansible-core-2.14.*

Exceptions

For the infrastructure repository it is required to use Ansible version 2.15.* due to this bug.

Goss

It is required to use Goss version v0.3.21.

To install, download the Goss binary according to your system from GitHub releases.

Style

Readability and consistency are essential to maintaining a healthy codebase. In this section we documented the best practices to follow when contributing to our codebase.

Documentation

When writing documentation, prefer one sentence per line. For more details, see here.

Templates

When working with templates, we recommend using spaces to separate different elements, such as variables, operators, filters, etc. This helps to improve the readability and maintainability of our templates and ensures that our template code is easy to understand and modify.

This applies to all templating languages we use, including:

Here are some examples of how to use spaces correctly in templates:

  • Go template:

    {{ if eq .Status "pending" }}
      {{ $total := add .Quantity .Reserved }}
      {{ if gt $total 10 }}
        The total quantity is greater than 10.
      {{ end }}
    {{ end }}
  • Jinja2 template:

    {% if user.is_authenticated %}
      {% for item in cart %}
        {% set price = item.price * item.quantity %}
        <li>{{ item.name }} - {{ price | currency }}</li>
      {% endfor %}
    {% endif %}

Here’s what not to do:

{{if eq .Status "pending"}}
  {{for item in cart}}
    {{set price=item.price*item.quantity}}
    <li>{{item.name}}-{{price|currency}}</li>
  {{end}}
{{endif}}

In this example, there are no spaces between the different elements of the template, making it difficult to read and understand.

Reviews

We appreciate all your contributions. Please make sure you follow these review rules we agreed upon in Testing Farm.

Comments Resolving

The contributor is obligated to resolve comments that had been addressed and require no further discussion.

In case more discussion is needed, leave the review comment open and wait for a reply from the reviewer.

If the reviewer is not responding, feel free to mention them in the comment.

If the reviewer is not responding even after being mentioned, please mention the following individuals:

  • mvadkert

  • happz

Required Approvals

We require at least 2 approvals for all our merge requests.

For RFDs, we require all Testing Farm Team members to provide an approval.