Skip to content

Commit a384d5b

Browse files
liangwen12yearrichm
authored andcommitted
docs(contributing): Add guide for running CI tests locally with tox-lsr
Signed-off-by: Wen Liang <[email protected]>
1 parent 8babd71 commit a384d5b

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

contributing.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,3 +118,50 @@ explanation about the NetworkManager API.
118118
podman stop lsr-ci-c7
119119
podman rm lsr-ci-c7
120120
```
121+
122+
## Running CI Tests Locally
123+
124+
### Use tox-lsr with qemu
125+
126+
The latest version of tox-lsr supports qemu testing.
127+
<https://github.com/linux-system-roles/tox-lsr#qemu-testing>
128+
129+
**Steps:**
130+
131+
1. If you are using RHEL or CentOS, enable the EPEL repository for your
132+
platform - <https://docs.fedoraproject.org/en-US/epel/>
133+
134+
2. Use yum or dnf to install `standard-test-roles-inventory-qemu`
135+
* If for some reason dnf/yum do not work, just download the script from
136+
<https://pagure.io/standard-test-roles/raw/master/f/inventory/standard-inventory-qcow2> <!--- wokeignore:rule=master -->
137+
* copy to your `$PATH`, and make sure it is executable
138+
139+
3. Install tox
140+
* Use yum/dnf to install `python3-tox` - if that does not work, then use
141+
`pip install --user tox`, then make sure `~/.local/bin` is in your `$PATH`
142+
143+
4. Install tox-lsr <https://github.com/linux-system-roles/tox-lsr#how-to-get-it>
144+
145+
```bash
146+
pip install --user git+https://github.com/linux-system-roles/tox-lsr@main
147+
```
148+
149+
5. Download the config file to `~/.config/linux-system-roles.json` from
150+
<https://github.com/linux-system-roles/linux-system-roles.github.io/blob/main/download/linux-system-roles.json>
151+
152+
6. Assuming you are in a git clone of a role repo which has a tox.ini file -
153+
you can use e.g.
154+
155+
```bash
156+
tox -e qemu-ansible-core-2.14 -- --image-name centos-9 tests/tests_default.yml
157+
```
158+
159+
There are many command line options and environment variables which can be used
160+
to control the behavior, and you can customize the testenv in tox.ini. See
161+
<https://github.com/linux-system-roles/tox-lsr#qemu-testing>
162+
163+
This method supports RHEL also - will download the latest image for a compose,
164+
and will set up the yum repos to point to internal composes.
165+
166+
See <https://linux-system-roles.github.io/contribute.html> for general
167+
development guidelines.

0 commit comments

Comments
 (0)